3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -7,7 +7,11 @@
<meta name="description" content="">
<meta name="author" content="">
<!-- splash -->
<!-- debug begin -->
<link rel="stylesheet/less" type="text/css" href="resources/less/application.less" />
<!-- debug end -->
<!-- splash -->
<style type="text/css">
.loadmask {
@@ -22,35 +26,132 @@
z-index: 20002;
}
.loadmask-body {
position:relative;
top:44%;
.loader-page {
top: 50%;
left: 50%;
width: 50px;
height: 180px;
z-index: 100;
position: absolute;
margin-top: -100px;
}
.loadmask-logo {
display:inline-block;
min-width:220px;
height: 62px;
vertical-align:top;
background-image:url('./resources/img/loading-logo.gif');
background-repeat:no-repeat;
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
}
#loadmask-text {
color: #b2b2b2;
font-size: 10px;
font-weight: bold;
font-family: Arial;
height:14px;
margin-top:32px;
padding-left:40px;
text-align:left;
text-transform: uppercase;
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
</style>
<link href="../../../3rdparty/bootstrap/css/bootstrap.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@@ -58,6 +159,11 @@
<body class="embed-body">
<!-- debug begin -->
<script type="text/javascript">var less=less||{};less.env='development';</script>
<script src="../../../vendor/less/dist/less-1.5.1.js" type="text/javascript"></script>
<!-- debug end -->
<!--facebook button-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
@@ -72,13 +178,12 @@
<!--twitter button-->
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<div id="loading-mask" class="loadmask">
<div class="loadmask-body" align="center">
<div class="loadmask-logo">
<!-- <div id="loadmask-text">LOADING APPLICATION</div> -->
</div>
</div>
<div class="loader-page">
<div class="romb" id="blue"></div>
<div class="romb" id="green"></div>
<div class="romb" id="red"></div>
</div>
</div>
<div class="viewer">
@@ -87,9 +192,8 @@
</div>
<div class="overlay-controls" style="margin-left: -32px">
<ul class="left" style="width: 90px;">
<ul class="left">
<li id="id-btn-zoom-in"><button class="overlay"><i class="overlay-icon-zoom-in"></i></button></li>
<li style="width: 10px"></li>
<li id="id-btn-zoom-out"><button class="overlay"><i class="overlay-icon-zoom-out"></i></button></li>
</ul>
</div>
@@ -108,15 +212,19 @@
</ul>
</div>
<div class="error modal hide" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-header">
<h3 id="id-critical-error-title"></h3>
</div>
<div class="modal-body">
<p id="id-critical-error-message"></p>
</div>
<div class="modal-footer">
<button id="id-critical-error-close" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
<div class="modal fade error" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
<p id="id-critical-error-message"></p>
</div>
<div class="modal-footer">
<button id="id-critical-error-close" class="btn btn-sm btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</div>
</div>
@@ -125,124 +233,20 @@
<div class="cmd-loader-title">Please wait...</div>
</div>
<!--3td party-->
<script type="text/javascript" src="../../../3rdparty/jquery/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/mousewheel/jquery.mousewheel.js"></script>
<script type="text/javascript" src="../../../3rdparty/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="../../../3rdparty/ZeroClipboard/ZeroClipboard.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../../../3rdparty/sockjs/sockjs-0.3.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/underscore/underscore-min.js"></script>
<!--vendor-->
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../../vendor/jquery.browser/dist/jquery.browser.min.js"></script>
<script type="text/javascript" src="../../../vendor/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="../../../vendor/ZeroClipboard/ZeroClipboard.min.js"></script>
<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<!--sdk-->
<link rel="stylesheet" type="text/css" href="../../../sdk/Excel/css/main.css"/>
<script type="text/javascript" src="../../../sdk/Common/docscoapisettings.js"></script>
<script type="text/javascript" src="../../../sdk/Common/AllFonts.js"></script>
<script type="text/javascript" src="../../../sdk/Common/browser.js"></script>
<script type="text/javascript" src="../../../sdk/Common/docscoapisettings.js"></script>
<script type="text/javascript" src="../../../sdk/Common/docscoapicommon.js"></script>
<script type="text/javascript" src="../../../sdk/Common/docscoapi.js"></script>
<script type="text/javascript" src="../../../sdk/Common/downloaderfiles.js"></script>
<script type="text/javascript" src="../../../sdk/Common/apiCommon.js"></script>
<script type="text/javascript" src="../../../sdk/Common/commonDefines.js"></script>
<script type="text/javascript" src="../../../sdk/Common/editorscommon.js"></script>
<script type="text/javascript" src="../../../sdk/Common/NumFormat.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Charts/charts.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Charts/DrawingObjects.js"></script>
<script type="text/javascript" src="../../../sdk/Common/FontsFreeType/font_engine.js"></script>
<script type="text/javascript" src="../../../sdk/Common/FontsFreeType/FontFile.js"></script>
<script type="text/javascript" src="../../../sdk/Common/FontsFreeType/FontManager.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/HatchPattern.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/Externals.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/Graphics.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/Metafile.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/GlobalLoaders.js"></script>
<script type="text/javascript" src="../../../sdk/Common/trackFile.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/apiDefines.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/offlinedocs/test-workbook9/Editor.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/offlinedocs/empty-workbook.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/utils/utils.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/clipboard.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/autofilters.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/graphics/DrawingContext.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/graphics/pdfprinter.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/CollaborativeEditing.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/ConditionalFormatting.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/parserFormula.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/dateandtimeFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/engineeringFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/cubeFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/databaseFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/textanddataFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/statisticalFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/financialFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/mathematicFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/lookupandreferenceFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/informationFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/logicalFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/Serialize.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/WorkbookElems.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/Workbook.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/CellInfo.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/AdvancedOptions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/History.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/UndoRedo.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/CellComment.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/StringRender.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/CellTextRender.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/CellEditorView.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/WorksheetView.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/HandlerList.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/EventsController.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/WorkbookView.js"></script>
<script type="text/javascript" src="../../../sdk/Common/scroll.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/ColorArray.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Shapes/EditorSettings.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Shapes/Serialize.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Shapes/SerializeWriter.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Editor/SerializeCommon.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Format.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Editor/GraphicObjects/ObjectTypes/CreateGeometry.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Geometry.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Path.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Editor/GraphicObjects/Math.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/ArcTo.js"></script>
<script type="text/javascript" src="../../../sdk/Common/SerializeCommonWordExcel.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/DrawingObjectsController.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/States.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/GroupShape.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Image.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Shape.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/TextBody.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Styles.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Numbering.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ParagraphContent.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Paragraph.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/DocumentContent.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/FontClassification.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Chart.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ChartLayout.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ChartLegend.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ChartTitle.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/AdjustmentTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/ResizeTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/RotateTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/NewShapeTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/PolyLine.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/Spline.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/MoveTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Hit.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Controls.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Graphics.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Overlay.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/GlobalCounters.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/DrawingDocument.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/ShapeDrawer.js"></script>
<script type="text/javascript" src="../../../sdk/Word/apiCommon.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/api.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/sdk-all.js"></script>
<!--application-->
<link href="resources/css/application.css" rel="stylesheet">
<script type="text/javascript" src="../../common/Gateway.js"></script>
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="js/ApplicationView.js"></script>

View File

@@ -22,35 +22,132 @@
z-index: 20002;
}
.loadmask-body {
position:relative;
top:44%;
.loader-page {
top: 50%;
left: 50%;
width: 50px;
height: 180px;
z-index: 100;
position: absolute;
margin-top: -100px;
}
.loadmask-logo {
display:inline-block;
min-width:220px;
height: 62px;
vertical-align:top;
background-image:url('./resources/img/loading-logo.gif');
background-repeat:no-repeat;
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
}
#loadmask-text {
color: #b2b2b2;
font-size: 10px;
font-weight: bold;
font-family: Arial;
height:14px;
margin-top:32px;
padding-left:40px;
text-align:left;
text-transform: uppercase;
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
</style>
<link href="../../../3rdparty/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@@ -74,19 +171,18 @@
<div id="loading-mask" class="loadmask">
<div class="loadmask-body" align="center">
<div class="loadmask-logo">
<!-- <div id="loadmask-text">LOADING APPLICATION</div> -->
</div>
</div>
<div class="loader-page">
<div class="romb" id="blue"></div>
<div class="romb" id="green"></div>
<div class="romb" id="red"></div>
</div>
</div>
<div id="editor_sdk" class="viewer" style="overflow: hidden;"></div>
<div class="overlay-controls" style="margin-left: -32px">
<ul class="left" style="width: 90px;">
<ul class="left">
<li id="id-btn-zoom-in"><button class="overlay"><i class="overlay-icon-zoom-in"></i></button></li>
<li style="width: 10px"></li>
<li id="id-btn-zoom-out"><button class="overlay"><i class="overlay-icon-zoom-out"></i></button></li>
</ul>
</div>
@@ -107,15 +203,19 @@
</ul>
</div>
<div class="error modal hide" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-header">
<h3 id="id-critical-error-title"></h3>
</div>
<div class="modal-body">
<p id="id-critical-error-message"></p>
</div>
<div class="modal-footer">
<button id="id-critical-error-close" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
<div class="modal fade error" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
<p id="id-critical-error-message"></p>
</div>
<div class="modal-footer">
<button id="id-critical-error-close" class="btn btn-sm btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</div>
</div>
@@ -124,14 +224,13 @@
<div class="cmd-loader-title">Please wait...</div>
</div>
<!--3td party-->
<script type="text/javascript" src="../../../3rdparty/jquery/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/mousewheel/jquery.mousewheel.js"></script>
<script type="text/javascript" src="../../../3rdparty/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/ZeroClipboard/ZeroClipboard.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../../../3rdparty/sockjs/sockjs-0.3.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/underscore/underscore-min.js"></script>
<!--vendor-->
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../../vendor/jquery/jquery.browser.min.js"></script>
<script type="text/javascript" src="../../../vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../../vendor/ZeroClipboard/ZeroClipboard.min.js"></script>
<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<!--sdk-->

View File

@@ -1,48 +1,50 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var ApplicationView = new(function () {
function createView() {
$("#id-btn-share").popover({
trigger: "manual",
template: '<div class="popover share" id="id-popover-share"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>',
content: '<div class="share-link">' + '<span class="caption">Link:</span>' + '<span id="id-short-url" class="input-medium uneditable-input"></span>' + '<button id="id-btn-copy-short" type="button" class="btn btn-mini btn-primary" style="width: 65px;" data-copied-text="Copied">Copy</button>' + "</div> " + '<div class="share-buttons" style="height: 25px" id="id-popover-social-container" data-loaded="false">' + "<ul></ul>" + "</div>"
}).popover("show");
$("#id-btn-embed").popover({
trigger: "manual",
template: '<div class="popover embed" id="id-popover-embed"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>',
content: '<div class="size-manual">' + '<span class="caption">Width:</span>' + '<input id="id-input-embed-width" class="input-mini" type="text" value="400px">' + '<input id="id-input-embed-height" class="right input-mini" type="text" value="600px">' + '<span class="right caption">Height:</span>' + "</div>" + '<textarea id="id-textarea-embed" rows="4" readonly></textarea>' + '<button id="id-btn-copy-embed" type="button" class="btn btn-mini btn-primary" data-copied-text="Copied">Copy</button>'
}).popover("show");
}
return {
create: createView
};
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var ApplicationView = new(function () {
function createView() {
$("#id-btn-share").popover({
trigger: "manual",
html: true,
template: '<div class="popover share" id="id-popover-share"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>',
content: '<div class="share-link">' + '<span class="caption">Link:</span>' + '<input id="id-short-url" class="input-xs form-control" readonly/>' + '<button id="id-btn-copy-short" type="button" class="btn btn-xs btn-primary" style="width: 65px;" data-copied-text="Copied">Copy</button>' + "</div> " + '<div class="share-buttons" style="height: 25px" id="id-popover-social-container" data-loaded="false">' + "<ul></ul>" + "</div>"
}).popover("show");
$("#id-btn-embed").popover({
trigger: "manual",
html: true,
template: '<div class="popover embed" id="id-popover-embed"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>',
content: '<div class="size-manual">' + '<span class="caption">Width:</span>' + '<input id="id-input-embed-width" class="form-control input-xs" type="text" value="400px">' + '<input id="id-input-embed-height" class="form-control input-xs right" type="text" value="600px">' + '<span class="right caption">Height:</span>' + "</div>" + '<textarea id="id-textarea-embed" rows="4" class="form-control" readonly></textarea>' + '<button id="id-btn-copy-embed" type="button" class="btn btn-xs btn-primary" data-copied-text="Copied">Copy</button>'
}).popover("show");
}
return {
create: createView
};
})();

View File

@@ -1,37 +1,37 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
(function ($) {
$(function () {
ApplicationView.create();
ApplicationController.create();
});
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
(function ($) {
$(function () {
ApplicationView.create();
ApplicationController.create();
});
})(window.jQuery);

View File

@@ -1,545 +0,0 @@
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
line-height: 0;
}
.clearfix:after {
clear: both;
}
.hide-text {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.btn-mini {
font-weight: bold;
}
.btn-primary {
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
background-color: #7a9adf;
background-image: -moz-linear-gradient(top, #8aacf1, #6180c4);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#8aacf1), to(#6180c4));
background-image: -webkit-linear-gradient(top, #8aacf1, #6180c4);
background-image: -o-linear-gradient(top, #8aacf1, #6180c4);
background-image: linear-gradient(to bottom, #8aacf1, #6180c4);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8aacf1', endColorstr='#ff6180c4', GradientType=0);
border-color: #6180c4 #6180c4 #3b5a9e;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
*background-color: #6180c4;
/* Darken IE7 buttons by default so they stand out more given they won't have borders */
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary.active,
.btn-primary.disabled,
.btn-primary[disabled] {
color: #ffffff;
background-color: #6180c4;
*background-color: #4e71bd;
}
.btn-primary:active,
.btn-primary.active {
background-color: #4264b0 \9;
}
.embed-body {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
font-size: 12px;
overflow: hidden;
}
.popover.top {
margin-top: -10px;
}
.viewer {
position: absolute;
margin: 0;
padding: 0;
left: 0;
right: 0;
}
.viewer.top {
top: 32px;
bottom: 0;
}
.viewer.bottom {
top: 0;
bottom: 30px;
}
.toolbar {
position: fixed;
font-size: 12px;
min-width: 340px;
background-color: #dfdfdf;
background-image: -moz-linear-gradient(top, #ebebeb, #cccccc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ebebeb), to(#cccccc));
background-image: -webkit-linear-gradient(top, #ebebeb, #cccccc);
background-image: -o-linear-gradient(top, #ebebeb, #cccccc);
background-image: linear-gradient(to bottom, #ebebeb, #cccccc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#ffcccccc', GradientType=0);
}
.toolbar.top {
top: 0;
left: 0;
width: 100%;
height: 32px;
-webkit-box-shadow: inset 0 -1px 0 #929292, inset 0 1px 0 #fafafa;
-moz-box-shadow: inset 0 -1px 0 #929292, inset 0 1px 0 #fafafa;
box-shadow: inset 0 -1px 0 #929292, inset 0 1px 0 #fafafa;
}
.toolbar.bottom {
bottom: 0;
left: 0;
width: 100%;
height: 30px;
-webkit-box-shadow: inset 0 1px 0 #929292, inset 0 2px 0 #fafafa;
-moz-box-shadow: inset 0 1px 0 #929292, inset 0 2px 0 #fafafa;
box-shadow: inset 0 1px 0 #929292, inset 0 2px 0 #fafafa;
}
.toolbar ul {
position: absolute;
list-style-type: none;
margin: 0;
}
.toolbar ul li input {
height: 14px;
font-size: 12px;
margin: 4px 3px 5px;
padding: 4px 0;
text-align: center;
}
.toolbar ul li .text {
cursor: default;
}
.toolbar ul.left {
left: 0;
}
.toolbar ul.left li {
float: left;
}
.toolbar ul.right {
right: 0;
}
.toolbar ul.right li {
float: left;
}
.toolbar ul .separator {
height: 24px;
margin: 4px 9px;
border-right: 1px solid #fafafa;
border-left: 1px solid #929292;
}
a.brand-logo {
display: block;
background-image: url("../img/glyphicons.png");
width: 127px;
height: 20px;
margin: 5px 0 0 10px;
background-position: 0 -100px;
}
[class^="control-icon-"],
[class*=" control-icon-"] {
display: inline-block;
width: 20px;
height: 20px;
vertical-align: text-top;
background-image: url("../img/glyphicons.png");
background-repeat: no-repeat;
margin-top: -2px;
}
[class^="overlay-icon-"],
[class*=" overlay-icon-"] {
display: inline-block;
width: 32px;
height: 32px;
vertical-align: text-top;
background-image: url("../img/glyphicons.png");
background-repeat: no-repeat;
opacity: .3;
}
.control-icon-share {
background-position: 0 0;
}
.control-icon-embed {
background-position: 0 -20px;
}
.control-icon-fullscreen {
background-position: 0 -40px;
}
.control-icon-close {
background-position: 0 -60px;
}
.control-icon-save {
background-position: 0 -80px;
}
.overlay-icon-zoom-in {
background-position: 0 -120px;
}
.overlay-icon-zoom-out {
background-position: -32px -120px;
}
.control-btn {
display: inline-block;
padding: 1px 5px;
font-size: 12px;
line-height: 20px;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
margin: 4px 5px 0 0;
}
.control-btn i {
margin-right: 5px;
}
.control-btn.no-caption {
padding: 1px 2px;
}
.control-btn.no-caption i {
margin-right: 0;
}
.control-btn:hover {
color: #7698de;
text-decoration: none;
text-shadow: 0 1px 0 #fafafa;
}
.control-btn:hover .control-icon-share {
background-position: -20px 0;
}
.control-btn:hover .control-icon-embed {
background-position: -20px -20px;
}
.control-btn:hover .control-icon-fullscreen {
background-position: -20px -40px;
}
.control-btn:hover .control-icon-close {
background-position: -20px -60px;
}
.control-btn:hover .control-icon-save {
background-position: -20px -80px;
}
.control-btn:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.control-btn.active,
.control-btn:active {
color: #ffffff;
outline: 0;
border: 1px solid #4e71bd;
background-color: #7192d6;
background-image: -moz-linear-gradient(top, #6180c4, #8aacf1);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#6180c4), to(#8aacf1));
background-image: -webkit-linear-gradient(top, #6180c4, #8aacf1);
background-image: -o-linear-gradient(top, #6180c4, #8aacf1);
background-image: linear-gradient(to bottom, #6180c4, #8aacf1);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff6180c4', endColorstr='#ff8aacf1', GradientType=0);
text-shadow: 0 1px 0 #5f5f5f;
}
.control-btn.active .control-icon-share,
.control-btn:active .control-icon-share {
background-position: -40px 0;
}
.control-btn.active .control-icon-embed,
.control-btn:active .control-icon-embed {
background-position: -40px -20px;
}
.control-btn.active .control-icon-fullscreen,
.control-btn:active .control-icon-fullscreen {
background-position: -40px -40px;
}
.control-btn.active .control-icon-close,
.control-btn:active .control-icon-close {
background-position: -40px -60px;
}
.control-btn.active .control-icon-save,
.control-btn:active .control-icon-save {
background-position: -40px -80px;
}
.overlay-controls {
position: absolute;
bottom: 55px;
z-index: 10;
left: 50%;
}
.overlay-controls ul {
list-style-type: none;
margin: 0 auto;
}
.overlay-controls ul li {
display: inline-block;
}
.overlay-controls .overlay {
width: 32px;
height: 32px;
display: inline-block;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-color: transparent;
background-image: none;
border: none;
padding: 0;
line-height: 0;
}
.overlay-controls .overlay:hover [class^="overlay-icon-"],
.overlay-controls .overlay:hover [class*=" overlay-icon-"] {
opacity: .6;
}
.overlay-controls .overlay.active [class^="overlay-icon-"],
.overlay-controls .overlay:active [class^="overlay-icon-"],
.overlay-controls .overlay.active [class*=" overlay-icon-"],
.overlay-controls .overlay:active [class*=" overlay-icon-"] {
opacity: .8;
}
.errormask {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 30002;
}
.errormask .error-body {
position: relative;
top: 40%;
width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #FFFFFF;
border: 1px solid #C0C0C0;
}
.errormask .error-body .title {
font-weight: bold;
font-size: 1.6em;
padding-bottom: 10px;
}
.popover .popover-content {
padding: 14px;
}
.popover .btn {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.popover.hyperlink .popover-content {
padding: 5px 10px;
}
.popover.hyperlink .popover-content p {
display: block;
word-wrap: break-word;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.popover.share {
width: 280px;
}
.popover.share .share-link .caption {
margin-right: 8px;
float: left;
}
.popover.share .share-link .uneditable-input {
font-size: 1em;
padding: 0 4px;
margin-right: 5px;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
cursor: auto;
-moz-user-select: text;
-khtml-user-select: text;
-webkit-user-select: text;
-ms-user-select: text;
user-select: text;
}
.popover.share .share-link .input-medium {
width: 130px;
}
.popover.share .share-link .btn {
float: right;
}
.popover.share .share-buttons ul {
height: 25px;
list-style-type: none;
margin: 5px 0 0;
overflow: hidden;
}
.popover.share .share-buttons ul li {
display: inline-block;
float: left;
margin: 1px 5px 0 0;
vertical-align: middle;
}
.popover.share .share-buttons ul li.share-mail {
float: right;
margin: 0;
}
.popover.share .share-buttons ul li.share-mail a {
padding: 2px 8px;
}
.popover.share .share-buttons ul li.share-mail i {
margin-right: 5px;
}
.popover.share .share-buttons ul li.share-twitter {
max-width: 100px;
}
.popover.embed {
width: 270px;
}
.popover.embed .size-manual {
margin-bottom: 10px;
}
.popover.embed .right {
float: right;
}
.popover.embed .caption {
margin-right: 8px;
}
.popover.embed input {
font-size: 1em;
padding: 0 4px;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
margin: 0;
margin-top: -1px;
}
.popover.embed input.input-mini {
width: 40px;
}
.popover.embed textarea {
width: 228px;
resize: none;
cursor: auto;
font-size: 1em;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.popover.embed button {
float: right;
margin: 5px 0 15px;
width: 86px;
}
.modal.error .modal-footer {
text-align: center;
}
.cmd-loader-body {
z-index: 20001;
width: 300px;
padding: 16px;
margin: -71px 0 0 -166px;
border: none;
background-image: none;
background-color: #787C80;
opacity: 0.8;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.cmd-loader-body .cmd-loader-image {
background-image: url("../img/loading.gif");
background-repeat: no-repeat;
background-position: top center;
height: 74px;
width: 100%;
}
.cmd-loader-body .cmd-loader-title {
font-size: 18px;
font-weight: lighter;
color: #FFF;
text-align: center;
margin: 16px 24px 0 24px;
}
.viewer .sdk-view {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 25px;
}
.viewer ul.worksheet-list {
position: absolute;
left: 0;
right: 0;
bottom: 0;
margin: 0;
padding: 0 9px;
border-top: 1px solid #5A5A5A;
border-bottom: 1px solid #BABABA;
background-color: #bebebe;
background-image: -moz-linear-gradient(top, #b6b6b6, #cacaca);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b6b6b6), to(#cacaca));
background-image: -webkit-linear-gradient(top, #b6b6b6, #cacaca);
background-image: -o-linear-gradient(top, #b6b6b6, #cacaca);
background-image: linear-gradient(to bottom, #b6b6b6, #cacaca);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb6b6b6', endColorstr='#ffcacaca', GradientType=0);
box-shadow: 0 4px 4px -4px #333333 inset;
}
.viewer ul.worksheet-list li {
float: left;
cursor: pointer;
list-style: none;
margin: 0 2px 2px 3px;
padding: 0 13px;
color: #FFFFFF;
background-color: #909090;
background-image: -moz-linear-gradient(top, #9a9a9a, #828282);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#9a9a9a), to(#828282));
background-image: -webkit-linear-gradient(top, #9a9a9a, #828282);
background-image: -o-linear-gradient(top, #9a9a9a, #828282);
background-image: linear-gradient(to bottom, #9a9a9a, #828282);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff9a9a9a', endColorstr='#ff828282', GradientType=0);
box-shadow: 0 4px 4px -4px #333333 inset;
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
border-bottom: 1px solid #929292;
border-top-color: transparent;
}
.viewer ul.worksheet-list li.active {
margin-top: -1px;
padding: 0 12px;
border: 1px solid #929292;
border-top-color: transparent;
background: #DDDDDD;
color: #000;
box-shadow: none;
}

View File

@@ -1,4 +1,4 @@
// Bootstrap core variables and mixins
// Common styles
@import "../../../../common/embed/resources/less/common.less";
// Worksheets

View File

@@ -1,2 +0,0 @@
call npm install less
call npm install watchr

View File

@@ -1,99 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
(function () {
var path = require("path"),
util = require("util"),
fs = require("fs"),
watchr = require("watchr"),
less = require("less"),
cwd = process.cwd(),
watchPath = process.argv.length === 3 ? path.resolve(cwd, process.argv[2]) : cwd;
var options = {
compress: false,
yuicompress: false,
optimization: 1,
silent: false,
paths: [],
color: true,
strictImports: false
};
var parseLessFile = function (input, output) {
return function (e, data) {
if (e) {
console.log("lessc:", e.message);
}
new(less.Parser)({
paths: [path.dirname(input)],
optimization: options.optimization,
filename: input
}).parse(data, function (err, tree) {
if (err) {
less.writeError(err, options);
} else {
try {
var css = tree.toCSS({
compress: options.compress
});
if (output) {
var fd = fs.openSync(output, "w");
fs.writeSync(fd, css, 0, "utf8");
} else {
console.log("WARNING: output is undefined");
util.print(css);
}
} catch(e) {
less.writeError(e, options);
}
}
});
};
};
console.log(">>> Script is polling for changes. Press Ctrl-C to Stop.");
watchr.watch({
path: watchPath,
listener: function (eventName, filePath, fileCurrentStat, filePreviousStat) {
if (eventName == "change" || eventName == "update") {
console.log(">>> Change detected at", new Date().toLocaleTimeString(), "to:", path.basename(filePath));
var baseFilePath = path.basename(filePath, ".less");
fs.readFile(filePath, "utf-8", parseLessFile(filePath, "../css/" + baseFilePath + ".css"));
console.log("overwrite", baseFilePath + ".css");
}
},
next: function (err, watcher) {
if (err) {
console.log("!!! epic fail");
throw err;
}
console.log("Now watching:", watchPath);
}
});
})();

View File

@@ -1,36 +1,100 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.application({
name: "SSE",
autoCreateViewport: true,
controllers: ["Main"]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
require.config({
baseUrl: "../../",
waitSeconds: 30,
paths: {
jquery: "../vendor/jquery/jquery",
underscore: "../vendor/underscore/underscore",
backbone: "../vendor/backbone/backbone",
bootstrap: "../vendor/bootstrap/dist/js/bootstrap",
text: "../vendor/requirejs-text/text",
perfectscrollbar: "common/main/lib/mods/perfect-scrollbar",
jmousewheel: "../vendor/perfect-scrollbar/src/jquery.mousewheel",
xregexp: "../vendor/xregexp/xregexp-all-min",
sockjs: "../vendor/sockjs/sockjs.min",
allfonts: "../sdk/Common/AllFonts",
sdk: "../sdk/Excel/sdk-all",
api: "api/documents/api",
core: "common/main/lib/core/application",
notification: "common/main/lib/core/NotificationCenter",
keymaster: "common/main/lib/core/keymaster",
tip: "common/main/lib/util/Tip",
analytics: "common/Analytics",
gateway: "common/Gateway",
locale: "common/locale",
irregularstack: "common/IrregularStack"
},
shim: {
underscore: {
exports: "_"
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"]
},
perfectscrollbar: {
deps: ["jmousewheel"]
},
notification: {
deps: ["backbone"]
},
core: {
deps: ["backbone", "notification", "irregularstack"]
},
sdk: {
deps: ["jquery", "underscore", "allfonts", "xregexp", "sockjs"]
},
gateway: {
deps: ["jquery"]
},
analytics: {
deps: ["jquery"]
}
}
});
require(["backbone", "bootstrap", "core", "sdk", "api", "analytics", "gateway", "locale"], function (Backbone, Bootstrap, Core) {
Backbone.history.start();
var app = new Backbone.Application({
nameSpace: "SSE",
autoCreate: false,
controllers: ["Viewport", "DocumentHolder", "CellEditor", "FormulaDialog", "Print", "Toolbar", "Statusbar", "RightMenu", "LeftMenu", "Main", "Common.Controllers.Fonts", "Common.Controllers.Chat", "Common.Controllers.Comments"]
});
Common.Locale.apply();
require(["spreadsheeteditor/main/app/controller/Viewport", "spreadsheeteditor/main/app/controller/DocumentHolder", "spreadsheeteditor/main/app/controller/CellEditor", "spreadsheeteditor/main/app/controller/Toolbar", "spreadsheeteditor/main/app/controller/Statusbar", "spreadsheeteditor/main/app/controller/RightMenu", "spreadsheeteditor/main/app/controller/LeftMenu", "spreadsheeteditor/main/app/controller/Main", "spreadsheeteditor/main/app/controller/Print", "spreadsheeteditor/main/app/view/ParagraphSettings", "spreadsheeteditor/main/app/view/ImageSettings", "spreadsheeteditor/main/app/view/ChartSettings", "spreadsheeteditor/main/app/view/ShapeSettings", "common/main/lib/util/utils", "common/main/lib/controller/Fonts", "common/main/lib/controller/Comments", "common/main/lib/controller/Chat"], function () {
app.start();
});
});

View File

@@ -1,37 +1,37 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.store.FormulaGroups", {
extend: "Ext.data.ArrayStore",
storeId: "groupStore",
idIndex: 0,
fields: ["groupname", "groupid"]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone", "spreadsheeteditor/main/app/model/Formula"], function (Backbone) {
SSE.Collections = SSE.Collections || {};
SSE.Collections.FormulaGroups = Backbone.Collection.extend({
model: SSE.Models.FormulaGroup
});
});

View File

@@ -1,35 +1,40 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.store.ShapeGroups", {
extend: "Ext.data.Store",
model: "SSE.model.ShapeGroup"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone", "spreadsheeteditor/main/app/model/ShapeGroup"], function (Backbone) {
if (Common === undefined) {
var Common = {};
}
Common.Collections = Common.Collections || {};
SSE.Collections.ShapeGroups = Backbone.Collection.extend({
model: SSE.Models.ShapeGroup
});
});

View File

@@ -1,35 +1,40 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.store.TableTemplates", {
extend: "Ext.data.Store",
model: "SSE.model.TableTemplate"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone", "spreadsheeteditor/main/app/model/TableTemplate"], function (Backbone) {
if (Common === undefined) {
var Common = {};
}
Common.Collections = Common.Collections || {};
SSE.Collections.TableTemplates = Backbone.Collection.extend({
model: SSE.Models.TableTemplate
});
});

View File

@@ -1,288 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.CellEdit", {
extend: "Ext.app.Controller",
views: ["CellInfo"],
refs: [{
ref: "infoBox",
selector: "ssecellinfo"
},
{
ref: "dlgFormula",
selector: "sseformuladialog"
},
{
ref: "formulaList",
selector: "#formulas-list"
},
{
ref: "toolBar",
selector: "ssetoolbar"
},
{
ref: "cellTextBox",
selector: "#infobox-cell-edit"
},
{
ref: "buttonExpand",
selector: "#infobox-cell-multiline-button"
}],
init: function () {
this.control({
"sseformuladialog": {
beforeshow: function (o, eOpts) {},
show: function () {
this.getFormulaList().getSelectionModel().select(0);
this.getDlgFormula().focus(undefined, 100);
},
beforerender: function () {
if (! (this.getFormulaList().getStore().getCount() > 0)) {
this._reloadFormulas();
}
this.getDlgFormula().setGroups(this.arrGroups);
},
hide: function () {
this.getToolBar().fireEvent("editcomplete", this.getToolBar());
}
},
"sseformuladialog #formulas-group-combo": {
select: function (combo, records, eOpts) {
this.getFormulaList().getStore().clearFilter();
if (records[0].data["groupid"] !== "all") {
this.getFormulaList().getStore().filter("group", records[0].data["groupid"]);
}
}
},
"sseformuladialog #formulas-button-ok": {
click: function (btn) {
var data = this.getFormulaList().getSelectionModel().getSelection()[0].data;
this.api.asc_insertFormula(data.func);
this.getDlgFormula().hide();
}
},
"#formulas-list > gridview": {
afterrender: function (cmp) {
this.funcSearch = {
index: 0,
update: false,
word: ""
};
cmp.addElListener("keypress", Ext.bind(this.keypressFormulasList, this));
}
},
"#toolbar-button-insertformula": {
click: function (btn) {
this._handleInsertFormula(btn.menu, {
func: "SUM"
});
}
},
"#toolbar-menu-insertformula": {
click: this._handleInsertFormula
},
"#infobox-cell-edit": {
blur: function (o) {
if (this.api.isTextAreaBlur !== null) {
this.api.isTextAreaBlur = true;
}
},
specialkey: function (o, e) {
if (e.getKey() == e.ENTER && !e.altKey) {
this.api.isTextAreaBlur = null;
}
}
},
"ssecellinfo #infobox-cell-name": {
specialkey: function (o, e) {
if (e.getKey() == e.ENTER) {
this.api.asc_findCell(o.getValue());
this.getInfoBox().fireEvent("editcomplete", this.getInfoBox());
}
}
},
"ssecellinfo": {
resize: function (o, adjWidth, adjHeight, opts) {
this.getButtonExpand()[adjHeight > 23 ? "addCls" : "removeCls"]("button-collapse");
}
},
"ssecellinfo #infobox-cell-multiline-button": {
click: this._expandFormulaField
},
"#field-formula-splitter": {
beforedragstart: function (obj, event) {
return event.currentTarget && !event.currentTarget.disabled;
},
move: function (obj, x, y) {
delete this.getInfoBox().width;
}
}
});
},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.isTextAreaBlur = false;
this.api.asc_registerCallback("asc_onSelectionNameChanged", Ext.bind(this.updateBox, this));
this.api.asc_registerCallback("asc_onEditCell", Ext.bind(this._onEditCell, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
}
},
updateBox: function (info) {
this.getInfoBox().updateCellInfo(info);
},
_onEditCell: function (state) {
if (state == c_oAscCellEditorState.editStart) {
this.api.isCellEdited = true;
} else {
if (state == c_oAscCellEditorState.editEnd) {
this.api.isCellEdited = false;
}
}
},
_reloadFormulas: function () {
var arrFuncs = [];
this.arrGroups = [];
dlgFormulas.arrayFormula = [];
var groupFuncs, groupName, addGroup;
var qa = this.api.asc_getFormulasInfo();
for (var i = 0; i < qa.length; i++) {
groupName = qa[i].asc_getGroupName();
groupFuncs = qa[i].asc_getFormulasArray();
addGroup = false;
for (var j = 0; j < groupFuncs.length; j++) {
if (addGroup !== true) {
this.arrGroups.push(groupName);
addGroup = true;
}
arrFuncs.push({
group: groupName,
func: groupFuncs[j].asc_getName(),
args: groupFuncs[j].asc_getArguments()
});
dlgFormulas.arrayFormula.push(groupFuncs[j].asc_getName());
}
}
this.getFormulaList().getStore().loadData(arrFuncs);
},
_smoothScrollIntoView: function (element, container) {
var c = Ext.getDom(container) || Ext.getBody().dom,
o = element.getOffsetsTo(c),
t = o[1] + c.scrollTop;
var newCTop = t - c.clientHeight / 2;
if (newCTop < 0) {
newCTop = 0;
}
container.scrollTo("top", newCTop, true);
},
scrollViewToNode: function (dataview, node) {
if (dataview && node) {
var plugin = dataview.getPlugin("scrollpane");
if (plugin) {
var doScroll = new Ext.util.DelayedTask(function () {
plugin.scrollToElement(node, false, true);
});
doScroll.delay(100);
}
}
},
keypressFormulasList: function (event, el) {
if ((new Date().getTime()) - this.funcSearch.presstime > 3000) {
this.funcSearch.word = "";
}
var store = this.getFormulaList().getStore();
var symbol = String.fromCharCode(event.getCharCode());
var index = this.funcSearch.index;
if (/[a-zA-Z]/.test(symbol)) {
this.funcSearch.word += symbol;
this.funcSearch.index = store.find("func", this.funcSearch.word, index);
if (this.funcSearch.index < 0) {
this.funcSearch.word = symbol;
this.funcSearch.index = store.find("func", this.funcSearch.word, index + 1);
}
if (this.funcSearch.index < 0) {
this.funcSearch.index = store.find("func", this.funcSearch.word, 0);
}
if (! (this.funcSearch.index < 0)) {
this.getFormulaList().getSelectionModel().select(this.funcSearch.index);
var row = this.getFormulaList().getView().getNode(this.funcSearch.index);
this.scrollViewToNode(this.getFormulaList(), row);
}
}
this.funcSearch.presstime = new Date().getTime();
},
_handleInsertFormula: function (menu, item, opt) {
if (item.func === "more") {
var me = this;
dlgFormulas.addListener("onmodalresult", function (o, mr, s) {
me.getToolBar().fireEvent("editcomplete", me.getToolBar(), {
checkorder: true
});
Common.component.Analytics.trackEvent("Toolbar", "Insert formula");
},
this, {
single: true
});
dlgFormulas.show();
} else {
if (! (this.getFormulaList().getStore().getCount() > 0)) {
this._reloadFormulas();
}
var index = this.getFormulaList().getStore().findExact("func", item.func);
if (! (index < 0)) {
var record = this.getFormulaList().getStore().getAt(index);
this.api.asc_insertFormula(record.data.func, true);
}
this.getToolBar().fireEvent("editcomplete", this.getToolBar(), {
checkorder: true
});
Common.component.Analytics.trackEvent("ToolBar", "Insert formula");
}
},
_expandFormulaField: function () {
if (this.getInfoBox().getHeight() > 23) {
this.getInfoBox().keep_height = this.getInfoBox().getHeight();
this.getInfoBox().setHeight(23);
this.getButtonExpand().removeCls("button-collapse");
} else {
this.getInfoBox().setHeight(this.getInfoBox().keep_height);
this.getButtonExpand().addCls("button-collapse");
}
},
onCoAuthoringDisconnect: function () {
if (dlgFormulas.isVisible()) {
dlgFormulas.hide();
}
this.getInfoBox().setMode({
isDisconnected: true
});
}
});

View File

@@ -0,0 +1,173 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "spreadsheeteditor/main/app/view/CellEditor"], function (Viewport) {
SSE.Controllers.CellEditor = Backbone.Controller.extend({
views: ["CellEditor"],
events: function () {
return {
"keyup input#ce-cell-name": _.bind(this.onCellName, this),
"keyup textarea#ce-cell-content": _.bind(this.onKeyupCellEditor, this),
"blur textarea#ce-cell-content": _.bind(this.onBlurCellEditor, this),
"click button#ce-btn-expand": _.bind(this.expandEditorField, this),
"click button#ce-func-label": _.bind(this.onInsertFunction, this)
};
},
initialize: function () {
this.addListeners({
"CellEditor": {},
"Viewport": {
"layout:resizedrag": _.bind(this.onLayoutResize, this)
}
});
},
setApi: function (api) {
this.api = api;
this.api.isCEditorFocused = false;
this.api.asc_registerCallback("asc_onSelectionNameChanged", _.bind(this.onApiCellSelection, this));
this.api.asc_registerCallback("asc_onEditCell", _.bind(this.onApiEditCell, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onApiDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onApiDisconnect, this));
Common.NotificationCenter.on("cells:range", _.bind(this.onCellsRange, this));
return this;
},
setMode: function (mode) {
this.mode = mode;
this.editor.$btnfunc[this.mode.isEdit ? "removeClass" : "addClass"]("disabled");
},
onLaunch: function () {
this.editor = this.createView("CellEditor", {
el: "#cell-editing-box"
}).render();
this.bindViewEvents(this.editor, this.events);
this.editor.$el.parent().find(".after").css({
zIndex: "4"
});
var me = this;
$("#ce-cell-content").keydown(function (e) {
if (Common.UI.Keys.RETURN === e.keyCode || Common.UI.Keys.ESC === e.keyCode) {
me.api.asc_enableKeyEvents(true);
}
});
},
onApiEditCell: function (state) {
if (state == c_oAscCellEditorState.editStart) {
this.api.isCellEdited = true;
} else {
if (state == c_oAscCellEditorState.editEnd) {
this.api.isCellEdited = false;
this.api.isCEditorFocused = false;
}
}
},
onApiCellSelection: function (info) {
this.editor.updateCellInfo(info);
},
onApiDisconnect: function () {
this.mode.isEdit = false;
var controller = this.getApplication().getController("FormulaDialog");
if (controller) {
controller.hideDialog();
}
if (!this.mode.isEdit) {
$("#ce-func-label", this.editor.el).addClass("disabled");
}
},
onCellsRange: function (status) {
var isRangeSelection = (status != c_oAscSelectionDialogType.None);
if (isRangeSelection) {
this.editor.$cellname.attr("disabled", "disabled");
this.editor.$btnfunc["addClass"]("disabled");
} else {
this.editor.$cellname.removeAttr("disabled");
this.editor.$btnfunc["removeClass"]("disabled");
}
},
onLayoutResize: function (o, r) {
if (r == "cell:edit") {
if (this.editor.$el.height() > 19) {
if (!this.editor.$btnexpand.hasClass("btn-collapse")) {
this.editor.$btnexpand["addClass"]("btn-collapse");
}
} else {
this.editor.$btnexpand["removeClass"]("btn-collapse");
}
}
},
onCellName: function (e) {
if (e.keyCode == Common.UI.Keys.RETURN) {
var name = this.editor.$cellname.val();
if (name && name.length) {
this.api.asc_findCell(name);
}
Common.NotificationCenter.trigger("edit:complete", this.editor);
}
},
onBlurCellEditor: function () {
if (this.api.isCEditorFocused == "clear") {
this.api.isCEditorFocused = undefined;
} else {
if (this.api.isCellEdited) {
this.api.isCEditorFocused = true;
}
}
},
onKeyupCellEditor: function (e) {
if (e.keyCode == Common.UI.Keys.RETURN && !e.altKey) {
this.api.isCEditorFocused = "clear";
}
},
expandEditorField: function () {
if (this.editor.$el.height() > 19) {
this.editor.keep_height = this.editor.$el.height();
this.editor.$el.height(19);
this.editor.$btnexpand["removeClass"]("btn-collapse");
} else {
this.editor.$el.height(this.editor.keep_height || 74);
this.editor.$btnexpand["addClass"]("btn-collapse");
}
Common.NotificationCenter.trigger("layout:changed", "celleditor");
Common.NotificationCenter.trigger("edit:complete", this.editor, {
restorefocus: true
});
},
onInsertFunction: function () {
if (this.mode.isEdit && !this.editor.$btnfunc["hasClass"]("disabled")) {
var controller = this.getApplication().getController("FormulaDialog");
if (controller) {
$("#ce-func-label", this.editor.el).blur();
this.api.asc_enableKeyEvents(false);
controller.showDialog();
}
}
}
});
});

View File

@@ -1,164 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var url_create_template = "{0}?title={1}&template={2}&action=create&doctype=spreadsheet";
var url_create_new = "{0}?title={1}&action=create&doctype=spreadsheet";
Ext.define("SSE.controller.CreateFile", {
extend: "Ext.app.Controller",
uses: ["SSE.view.OpenDialog"],
views: ["CreateFile"],
stores: ["FileTemplates"],
refs: [{
ref: "filePanel",
selector: "ssefile"
}],
init: function () {
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
this.control({
"ssecreatenew": {
afterrender: Ext.bind(this.onRenderView, this, {
single: true
})
},
"ssecreatenew dataview": {
itemclick: this.onTemplateClick
},
"ssefile #file-button-createnew": {
click: function (el, event) {
var templates = this.getFileTemplatesStore();
if (! (templates && templates.getCount())) {
this.onBlankDocClick(event, el);
}
}
},
"ssefile button[docType]": {
click: this.clickBtnDownloadAs
},
"ssefile button[docType=0]": {
click: this.clickBtnDownloadAs
}
});
},
loadConfig: function (data) {
var templates = this.getFileTemplatesStore();
if (templates) {
templates.removeAll();
if (data && data.config) {
this.createUrl = data.config.createUrl;
this.nativeApp = data.config.nativeApp;
if (data.config.templates) {
templates.add(data.config.templates);
}
}
}
},
onRenderView: function () {
var btnBlankDocument = Ext.fly("id-create-blank-document");
if (btnBlankDocument) {
btnBlankDocument.addClsOnOver("over");
btnBlankDocument.on("click", this.onBlankDocClick, this);
}
},
onBlankDocClick: function (event, el) {
var filePanel = this.getFilePanel();
if (filePanel) {
filePanel.closeMenu();
}
if (this.nativeApp === true) {
this.api.asc_openNewDocument();
} else {
if (this.createUrl && this.createUrl.length) {
var newDocumentPage = window.open(Ext.String.format(url_create_new, this.createUrl, this.newDocumentTitle));
if (newDocumentPage) {
newDocumentPage.focus();
}
}
}
Common.component.Analytics.trackEvent("Create New", "Blank");
},
onTemplateClick: function (view, record, item, index, e) {
var filePanel = this.getFilePanel();
if (filePanel) {
filePanel.closeMenu();
}
if (this.nativeApp === true) {
this.api.asc_openNewDocument(record.data.name);
} else {
if (this.createUrl && this.createUrl.length) {
var newDocumentPage = window.open(Ext.String.format(url_create_template, this.createUrl, this.newDocumentTitle, record.data.name));
if (newDocumentPage) {
newDocumentPage.focus();
}
}
}
Common.component.Analytics.trackEvent("Create New");
},
setApi: function (o) {
this.api = o;
return this;
},
clickBtnDownloadAs: function (btn) {
if (this.api) {
if (this.api.asc_drawingObjectsExist() && btn.docType != c_oAscFileType.XLSX) {
Ext.create("Ext.window.MessageBox", {
buttonText: {
ok: "OK",
yes: "Yes",
no: "No",
cancel: this.textCancel
}
}).show({
title: this.textWarning,
msg: this.warnDownloadAs,
icon: Ext.Msg.QUESTION,
buttons: Ext.Msg.OKCANCEL,
scope: this,
fn: function (res, text) {
if (res == "ok") {
this.getFilePanel().fireEvent("downloadas");
this.api.asc_DownloadAs(btn.docType);
this.getFilePanel().closeMenu();
}
}
});
} else {
this.getFilePanel().fireEvent("downloadas");
this.api.asc_DownloadAs(btn.docType);
this.getFilePanel().closeMenu();
}
}
Common.component.Analytics.trackEvent("Download As", String(btn.docType));
},
warnDownloadAs: "If you continue saving in this format all the charts and images will be lost.<br>Are you sure you want to continue?",
newDocumentTitle : "Unnamed document",
textWarning: "Warning",
textCancel: "Cancel"
});

View File

@@ -0,0 +1,128 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "spreadsheeteditor/main/app/collection/FormulaGroups", "spreadsheeteditor/main/app/view/FormulaDialog"], function () {
SSE.Controllers = SSE.Controllers || {};
SSE.Controllers.FormulaDialog = Backbone.Controller.extend({
models: [],
views: ["FormulaDialog"],
collections: ["FormulaGroups"],
initialize: function () {},
setApi: function (api) {
this.api = api;
if (this.formulasGroups && this.api) {
this.loadingFormulas();
var me = this;
this.formulas = new SSE.Views.FormulaDialog({
api: this.api,
toolclose: "hide",
formulasGroups: this.formulasGroups,
handler: function (func) {
if (func && me.api) {
me.api.asc_insertFormula(func);
}
}
});
this.formulas.on({
"hide": function () {
if (me.api) {
me.api.asc_enableKeyEvents(true);
}
}
});
}
return this;
},
onLaunch: function () {
this.formulasGroups = this.getApplication().getCollection("FormulaGroups");
},
showDialog: function () {
if (this.formulas) {
this.formulas.show();
}
},
hideDialog: function () {
if (this.formulas && this.formulas.isVisible()) {
this.formulas.hide();
}
},
loadingFormulas: function () {
var i = 0,
j = 0,
ascGroupName, ascFunctions, functions, store = this.formulasGroups,
formulaGroup = null,
index = 0,
funcInd = 0,
info = null,
allFunctions = [],
allFunctionsGroup = null;
if (store) {
allFunctionsGroup = new SSE.Models.FormulaGroup({
name: "All",
index: index,
store: store
});
if (allFunctionsGroup) {
index += 1;
store.push(allFunctionsGroup);
info = this.api.asc_getFormulasInfo();
for (i = 0; i < info.length; i += 1) {
ascGroupName = info[i].asc_getGroupName();
ascFunctions = info[i].asc_getFormulasArray();
formulaGroup = new SSE.Models.FormulaGroup({
name: ascGroupName,
index: index,
store: store
});
index += 1;
functions = [];
for (j = 0; j < ascFunctions.length; j += 1) {
var func = new SSE.Models.FormulaModel({
index: funcInd,
group: ascGroupName,
name: ascFunctions[j].asc_getName(),
args: ascFunctions[j].asc_getArguments()
});
funcInd += 1;
functions.push(func);
allFunctions.push(func);
}
formulaGroup.set("functions", functions);
store.push(formulaGroup);
}
allFunctionsGroup.set("functions", _.sortBy(allFunctions, function (model) {
return model.get("name");
}));
}
}
}
});
});

View File

@@ -0,0 +1,571 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "common/main/lib/util/Shortcuts", "spreadsheeteditor/main/app/view/LeftMenu", "spreadsheeteditor/main/app/view/FileMenu"], function () {
SSE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({
views: ["LeftMenu", "FileMenu"],
initialize: function () {
this.addListeners({
"Common.Views.Chat": {
"hide": _.bind(this.onHideChat, this)
},
"Statusbar": {
"click:users": _.bind(this.clickStatusbarUsers, this)
},
"LeftMenu": {
"file:show": _.bind(this.fileShowHide, this, true),
"file:hide": _.bind(this.fileShowHide, this, false),
"comments:show": _.bind(this.commentsShowHide, this, true),
"comments:hide": _.bind(this.commentsShowHide, this, false),
},
"Common.Views.About": {
"show": _.bind(this.aboutShowHide, this, true),
"hide": _.bind(this.aboutShowHide, this, false)
},
"FileMenu": {
"item:click": _.bind(this.clickMenuFileItem, this),
"saveas:format": _.bind(this.clickSaveAsFormat, this),
"settings:apply": _.bind(this.applySettings, this),
"create:new": _.bind(this.onCreateNew, this),
"recent:open": _.bind(this.onOpenRecent, this)
},
"Toolbar": {
"file:settings": _.bind(this.clickToolbarSettings, this)
},
"SearchDialog": {
"hide": _.bind(this.onSearchDlgHide, this),
"search:back": _.bind(this.onQuerySearch, this, "back"),
"search:next": _.bind(this.onQuerySearch, this, "next"),
"search:replace": _.bind(this.onQueryReplace, this),
"search:replaceall": _.bind(this.onQueryReplaceAll, this)
}
});
},
onLaunch: function () {
this.leftMenu = this.createView("LeftMenu").render();
this.leftMenu.btnSearch.on("toggle", _.bind(this.onMenuSearch, this));
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
"command+shift+s,ctrl+shift+s": _.bind(this.onShortcut, this, "save"),
"command+f,ctrl+f": _.bind(this.onShortcut, this, "search"),
"command+h,ctrl+h": _.bind(this.onShortcut, this, "replace"),
"alt+f": _.bind(this.onShortcut, this, "file"),
"esc": _.bind(this.onShortcut, this, "escape"),
"ctrl+alt+q": _.bind(this.onShortcut, this, "chat"),
"command+shift+h,ctrl+shift+h": _.bind(this.onShortcut, this, "comments"),
"f1": _.bind(this.onShortcut, this, "help")
}
});
Common.util.Shortcuts.suspendEvents();
var me = this;
this.leftMenu.$el.find("button").each(function () {
$(this).on("keydown", function (e) {
if (Common.UI.Keys.RETURN === e.keyCode || Common.UI.Keys.SPACE === e.keyCode) {
me.leftMenu.btnFile.toggle(false);
me.leftMenu.btnAbout.toggle(false);
this.blur();
e.preventDefault();
me.api.asc_enableKeyEvents(true);
}
});
});
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onRenameCellTextEnd", _.bind(this.onRenameText, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onApiServerDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onApiServerDisconnect, this));
if (this.mode.canCoAuthoring) {
this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage", _.bind(this.onApiChatMessage, this));
}
if (!this.mode.isEditDiagram) {
this.api.asc_registerCallback("asc_onEditCell", _.bind(this.onApiEditCell, this));
}
this.leftMenu.getMenu("file").setApi(api);
return this;
},
setMode: function (mode) {
this.mode = mode;
this.leftMenu.setMode(mode);
this.leftMenu.getMenu("file").setMode(mode);
return this;
},
createDelayedElements: function () {
if (this.mode.canCoAuthoring) {
this.leftMenu.btnComments[this.mode.isEdit ? "show" : "hide"]();
this.leftMenu.btnChat.show();
this.leftMenu.setOptionsPanel("chat", this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"));
this.leftMenu.setOptionsPanel("comment", this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments"));
} else {
this.leftMenu.btnChat.hide();
this.leftMenu.btnComments.hide();
}
Common.util.Shortcuts.resumeEvents();
if (!this.mode.isEditDiagram) {
Common.NotificationCenter.on("cells:range", _.bind(this.onCellsRange, this));
}
return this;
},
clickMenuFileItem: function (menu, action, isopts) {
var close_menu = true;
switch (action) {
case "back":
break;
case "save":
this.api.asc_Save();
break;
case "print":
this.api.asc_Print();
break;
case "exit":
Common.Gateway.goBack();
break;
case "edit":
Common.Gateway.requestEditRights();
break;
case "new":
if (isopts) {
close_menu = false;
} else {
this.onCreateNew(undefined, "blank");
}
break;
default:
close_menu = false;
}
if (close_menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
},
clickSaveAsFormat: function (menu, format) {
if (format == c_oAscFileType.CSV || format != c_oAscFileType.XLSX && this.api.asc_drawingObjectsExist()) {
Common.UI.warning({
closable: false,
title: this.textWarning,
msg: this.warnDownloadAs,
buttons: ["ok", "cancel"],
callback: _.bind(function (btn) {
if (btn == "ok") {
this.api.asc_DownloadAs(format);
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
},
this)
});
} else {
this.api.asc_DownloadAs(format);
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
},
applySettings: function (menu) {
this.api.asc_setFontRenderingMode(parseInt(window.localStorage.getItem("sse-settings-fontrender")));
var value = window.localStorage.getItem("sse-settings-livecomment");
(!(value !== null && parseInt(value) == 0)) ? this.api.asc_showComments() : this.api.asc_hideComments();
if (this.mode.canAutosave) {
value = window.localStorage.getItem("sse-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
}
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
},
onCreateNew: function (menu, type) {
if (this.mode.nativeApp === true) {
this.api.asc_openNewDocument(type == "blank" ? "" : type);
} else {
var newDocumentPage = window.open(_.template("<%= url %>?title=<%= title %>" + '<% if (doctype != "blank") { %>&template=<%= doctype %><% } %>' + "&action=create&doctype=spreadsheet", {
url: this.mode.createUrl,
title: this.newDocumentTitle,
doctype: type
}));
if (newDocumentPage) {
newDocumentPage.focus();
}
}
if (menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
},
onOpenRecent: function (menu, url) {
if (menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
var recentDocPage = window.open(url);
if (recentDocPage) {
recentDocPage.focus();
}
Common.component.Analytics.trackEvent("Open Recent");
},
clickToolbarSettings: function (obj) {
if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == "opts") {
this.leftMenu.close();
} else {
this.leftMenu.showMenu("file:opts");
}
},
clickStatusbarUsers: function () {
if (this.mode.canCoAuthoring) {
if (this.leftMenu.btnChat.pressed) {
this.leftMenu.close();
} else {
this.leftMenu.showMenu("chat");
}
}
},
onHideChat: function () {
$(this.leftMenu.btnChat.el).blur();
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
},
onQuerySearch: function (d, w, opts) {
if (opts.textsearch && opts.textsearch.length) {
var options = this.dlgSearch.findOptions;
options.asc_setFindWhat(opts.textsearch);
options.asc_setScanForward(d != "back");
options.asc_setIsMatchCase(opts.matchcase);
options.asc_setIsWholeCell(opts.matchword);
options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked);
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked ? c_oAscFindLookIn.Formulas : c_oAscFindLookIn.Value);
if (!this.api.asc_findText(options)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
callback: function () {
me.dlgSearch.focus();
}
});
}
}
},
onQueryReplace: function (w, opts) {
if (!_.isEmpty(opts.textsearch) && !_.isEmpty(opts.textreplace)) {
this.api.isReplaceAll = false;
var options = this.dlgSearch.findOptions;
options.asc_setFindWhat(opts.textsearch);
options.asc_setReplaceWith(opts.textreplace);
options.asc_setIsMatchCase(opts.matchcase);
options.asc_setIsWholeCell(opts.matchword);
options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked);
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked ? c_oAscFindLookIn.Formulas : c_oAscFindLookIn.Value);
options.asc_setIsReplaceAll(false);
this.api.asc_replaceText(options);
}
},
onQueryReplaceAll: function (w, opts) {
if (!_.isEmpty(opts.textsearch) && !_.isEmpty(opts.textreplace)) {
this.api.isReplaceAll = true;
var options = this.dlgSearch.findOptions;
options.asc_setFindWhat(opts.textsearch);
options.asc_setReplaceWith(opts.textreplace);
options.asc_setIsMatchCase(opts.matchcase);
options.asc_setIsWholeCell(opts.matchword);
options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked);
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked ? c_oAscFindLookIn.Formulas : c_oAscFindLookIn.Value);
options.asc_setIsReplaceAll(true);
this.api.asc_replaceText(options);
}
},
showSearchDlg: function (show, action) {
if (!this.dlgSearch) {
var menuWithin = new Common.UI.MenuItem({
caption: this.textWithin,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: this.textSheet,
toggleGroup: "searchWithih",
checkable: true,
checked: true
},
{
caption: this.textWorkbook,
toggleGroup: "searchWithih",
checkable: true,
checked: false
}]
})
});
var menuSearch = new Common.UI.MenuItem({
caption: this.textSearch,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: this.textByRows,
toggleGroup: "searchByrows",
checkable: true,
checked: true
},
{
caption: this.textByColumns,
toggleGroup: "searchByrows",
checkable: true,
checked: false
}]
})
});
var menuLookin = new Common.UI.MenuItem({
caption: this.textLookin,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: this.textFormulas,
toggleGroup: "searchLookin",
checkable: true,
checked: true
},
{
caption: this.textValues,
toggleGroup: "searchLookin",
checkable: true,
checked: false
}]
})
});
this.dlgSearch = (new Common.UI.SearchDialog({
matchcase: true,
matchword: true,
matchwordstr: this.textItemEntireCell,
markresult: false,
extraoptions: [menuWithin, menuSearch, menuLookin]
}));
this.dlgSearch.menuWithin = menuWithin;
this.dlgSearch.menuSearch = menuSearch;
this.dlgSearch.menuLookin = menuLookin;
this.dlgSearch.findOptions = new Asc.asc_CFindOptions();
}
if (show) {
var mode = this.mode.isEdit ? (action || undefined) : "no-replace";
if (this.dlgSearch.isVisible()) {
this.dlgSearch.setMode(mode);
this.dlgSearch.focus();
} else {
this.dlgSearch.show(mode);
}
this.api.asc_closeCellEditor();
} else {
this.dlgSearch["hide"]();
}
},
onMenuSearch: function (obj, show) {
this.showSearchDlg(show);
},
onSearchDlgHide: function () {
this.leftMenu.btnSearch.toggle(false, true);
$(this.leftMenu.btnSearch.el).blur();
this.api.asc_enableKeyEvents(true);
},
onRenameText: function (found, replaced) {
var me = this;
if (this.api.isReplaceAll) {
Common.UI.info({
msg: (found) ? ((!found - replaced) ? Common.Utils.String.format(this.textReplaceSuccess, replaced) : Common.Utils.String.format(this.textReplaceSkipped, found - replaced)) : this.textNoTextFound,
callback: function () {
me.dlgSearch.focus();
}
});
} else {
var sett = this.dlgSearch.getSettings();
var options = this.dlgSearch.findOptions;
options.asc_setFindWhat(sett.textsearch);
options.asc_setScanForward(true);
options.asc_setIsMatchCase(sett.matchcase);
options.asc_setIsWholeCell(sett.matchword);
options.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked);
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked ? c_oAscFindLookIn.Formulas : c_oAscFindLookIn.Value);
if (!me.api.asc_findText(options)) {
Common.UI.info({
msg: this.textNoTextFound,
callback: function () {
me.dlgSearch.focus();
}
});
}
}
},
onApiServerDisconnect: function () {
this.mode.isEdit = false;
this.leftMenu.close();
this.leftMenu.btnComments.setDisabled(true);
this.leftMenu.btnChat.setDisabled(true);
this.leftMenu.getMenu("file").setMode({
isDisconnected: true
});
if (this.dlgSearch) {
this.leftMenu.btnSearch.toggle(false, true);
this.dlgSearch["hide"]();
}
},
onApiChatMessage: function () {
this.leftMenu.markCoauthOptions();
},
commentsShowHide: function (state) {
if (this.api) {
var value = window.localStorage.getItem("sse-settings-livecomment");
if (value !== null && parseInt(value) == 0) {
(state) ? this.api.asc_showComments() : this.api.asc_hideComments();
}
if (state) {
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();
}
this.api.asc_enableKeyEvents(!state);
if (!state) {
$(this.leftMenu.btnComments.el).blur();
}
}
},
fileShowHide: function (state) {
if (this.api) {
this.api.asc_closeCellEditor();
this.api.asc_enableKeyEvents(!state);
if (!state) {
$(this.leftMenu.btnFile.el).blur();
}
}
},
aboutShowHide: function (state) {
if (this.api) {
this.api.asc_closeCellEditor();
this.api.asc_enableKeyEvents(!state);
if (!state) {
$(this.leftMenu.btnAbout.el).blur();
}
}
},
onShortcut: function (s, e) {
if (this.mode.isEditDiagram && s != "escape") {
return false;
}
switch (s) {
case "replace":
case "search":
if (!this.leftMenu.btnSearch.isDisabled()) {
Common.UI.Menu.Manager.hideAll();
this.showSearchDlg(true, s);
this.leftMenu.btnSearch.toggle(true, true);
this.leftMenu.btnFile.toggle(false);
this.leftMenu.btnAbout.toggle(false);
}
return false;
case "save":
if (this.mode.canDownload && !this.leftMenu.btnFile.isDisabled()) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("file:saveas");
}
return false;
case "help":
if (!this.leftMenu.btnFile.isDisabled()) {
Common.UI.Menu.Manager.hideAll();
this.api.asc_closeCellEditor();
this.leftMenu.showMenu("file:help");
}
return false;
case "file":
if (!this.leftMenu.btnFile.isDisabled()) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("file");
}
return false;
case "escape":
var statusbar = SSE.getController("Statusbar");
var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]');
if (menu_opened.length) {
$.fn.dropdown.Constructor.prototype.keydown.call(menu_opened[0], e);
return false;
}
if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || $(e.target).parents("#left-menu").length && this.api.isCellEdited !== true) {
this.leftMenu.close();
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
return false;
}
if (this.mode.isEditDiagram) {
menu_opened = $(document.body).find(".open > .dropdown-menu");
if (!this.api.isCellEdited && !menu_opened.length) {
Common.Gateway.internalMessage("shortcut", {
key: "escape"
});
return false;
}
}
break;
case "chat":
if (this.mode.canCoAuthoring) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("chat");
}
return false;
case "comments":
if (this.mode.canCoAuthoring && this.mode.isEdit) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("comments");
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();
}
return false;
}
},
onCellsRange: function (status) {
var isRangeSelection = (status != c_oAscSelectionDialogType.None);
this.leftMenu.btnFile.setDisabled(isRangeSelection);
this.leftMenu.btnAbout.setDisabled(isRangeSelection);
this.leftMenu.btnSearch.setDisabled(isRangeSelection);
},
onApiEditCell: function (state) {
var isEditFormula = (state == c_oAscCellEditorState.editFormula);
this.leftMenu.btnFile.setDisabled(isEditFormula);
this.leftMenu.btnAbout.setDisabled(isEditFormula);
this.leftMenu.btnSearch.setDisabled(isEditFormula);
},
textNoTextFound: "Text not found",
newDocumentTitle: "Unnamed document",
textItemEntireCell: "Entire cell contents",
requestEditRightsText: "Requesting editing rights...",
textReplaceSuccess: "Search has been done. {0} occurrences have been replaced",
textReplaceSkipped: "The replacement has been made. {0} occurrences were skipped.",
warnDownloadAs: "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
textWarning : "Warning",
textSheet: "Sheet",
textWorkbook: "Workbook",
textByColumns: "By columns",
textByRows: "By rows",
textFormulas: "Formulas",
textValues: "Values",
textWithin: "Within",
textSearch: "Search",
textLookin: "Look in"
},
SSE.Controllers.LeftMenu || {}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,382 +1,391 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Print", {
extend: "Ext.app.Controller",
uses: ["SSE.view.DocumentStatusInfo", "SSE.view.PrintSettings"],
views: ["MainSettingsPrint"],
refs: [{
ref: "toolbar",
selector: "ssetoolbar"
},
{
ref: "printAdvanced",
selector: "ssemainsettingsprint"
}],
init: function () {
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this.adjPrintParams.asc_setPrintType(c_oAscPrintType.ActiveSheets);
this.adjPrintParams.asc_setLayoutPageType(c_oAscLayoutPageType.FitToWidth);
this.control({
"documentstatusinfo": {
"updatesheetsinfo": function () {
this.isFillSheets = false;
this.diffParams = {};
}
},
"ssemainsettingsprint": {
show: function () {
if (!this.isFillSheets) {
this.isFillSheets = true;
this.updateSettings();
}
if (!this.isUpdatedSettings) {
this.isUpdatedSettings = true;
this.getPrintAdvanced().cmbSheet.select(this.getPrintAdvanced().cmbSheet.getStore().findRecord("sheetindex", this.api.asc_getActiveWorksheetIndex()));
}
}
},
"sseprintsettings": {
onmodalresult: this.closePrintSettings
},
"#advsettings-print-combo-sheets": {
change: this.comboSheetsChange
},
"#advsettings-print-button-save": {
click: this.querySavePrintSettings
},
"#toolbar-menuitem-print-options": {
click: this.openPrintSettings
},
"#dialog-print-options-ok": {
click: this.queryClosePrintSettings
},
"#dialog-printoptions-grouprange": {
change: function (obj, newvalue, oldvalue, opts) {
if (typeof(newvalue.printrange) == "number") {
var panel = obj.up("window");
if (newvalue.printrange == c_oAscPrintType.EntireWorkbook) {
this.indeterminatePageOptions(panel);
} else {
if (obj.lastCheckedRange == c_oAscPrintType.EntireWorkbook) {
this.fillPageOptions(panel, this.api.asc_getPageOptions());
}
}
obj.lastCheckedRange = newvalue.printrange;
}
}
}
});
},
setApi: function (o) {
this.api = o;
},
updateSettings: function () {
var panel = this.getPrintAdvanced();
panel.cmbSheet.getStore().removeAll();
var wc = this.api.asc_getWorksheetsCount(),
i = -1;
var items = [{
sheetname: this.strAllSheets,
sheetindex: -255
}];
while (++i < wc) {
if (!this.api.asc_isWorksheetHidden(i)) {
items.push({
sheetname: this.api.asc_getWorksheetName(i).replace(/\s/g, "&nbsp;"),
sheetindex: i
});
}
}
panel.cmbSheet.getStore().loadData(items);
},
comboSheetsChange: function (combo, newvalue, oldvalue, eopts) {
var panel = this.getPrintAdvanced();
if (newvalue == -255) {
this.indeterminatePageOptions(panel);
} else {
this.fillPageOptions(panel, this.api.asc_getPageOptions(newvalue));
}
},
isDiffRefill: function () {
for (var item in this.diffParams) {
if (this.diffParams[item] == undefined) {
return true;
}
}
return item == undefined;
},
indeterminatePageOptions: function (panel) {
if (this.isDiffRefill()) {
var wc = this.api.asc_getWorksheetsCount();
if (wc == 1) {
this.diffParams.orientation = false;
this.diffParams.size = false;
this.diffParams.headings = false;
this.diffParams.grid = false;
this.diffParams.margintop = false;
this.diffParams.marginright = false;
this.diffParams.marginbottom = false;
this.diffParams.marginleft = false;
} else {
var index = 0;
var opts = this.api.asc_getPageOptions(index),
opts_next;
while (++index < wc) {
opts_next = this.api.asc_getPageOptions(index);
if (this.diffParams.orientation == undefined) {
this.diffParams.orientation = opts.asc_getPageSetup().asc_getOrientation() != opts_next.asc_getPageSetup().asc_getOrientation();
}
if (this.diffParams.size == undefined) {
this.diffParams.size = (opts.asc_getPageSetup().asc_getWidth() != opts_next.asc_getPageSetup().asc_getWidth() || opts.asc_getPageSetup().asc_getHeight() != opts_next.asc_getPageSetup().asc_getHeight());
}
if (this.diffParams.headings == undefined) {
this.diffParams.headings = opts.asc_getHeadings() != opts_next.asc_getHeadings();
}
if (this.diffParams.grid == undefined) {
this.diffParams.grid = opts.asc_getGridLines() != opts_next.asc_getGridLines();
}
if (this.diffParams.margintop == undefined) {
this.diffParams.margintop = opts.asc_getPageMargins().asc_getTop() != opts_next.asc_getPageMargins().asc_getTop();
}
if (this.diffParams.marginright == undefined) {
this.diffParams.marginright = opts.asc_getPageMargins().asc_getRight() != opts_next.asc_getPageMargins().asc_getRight();
}
if (this.diffParams.marginbottom == undefined) {
this.diffParams.marginbottom = opts.asc_getPageMargins().asc_getBottom() != opts_next.asc_getPageMargins().asc_getBottom();
}
if (this.diffParams.marginleft == undefined) {
this.diffParams.marginleft = opts.asc_getPageMargins().asc_getLeft() != opts_next.asc_getPageMargins().asc_getLeft();
}
}
}
}
if (this.diffParams.orientation) {
panel.cmbPaperOrientation.setValue("-");
}
if (this.diffParams.size) {
panel.cmbPaperSize.setValue("-");
}
if (this.diffParams.margintop) {
panel.spnMarginTop.setRawValue("-");
}
if (this.diffParams.marginright) {
panel.spnMarginRight.setRawValue("-");
}
if (this.diffParams.marginbottom) {
panel.spnMarginBottom.setRawValue("-");
}
if (this.diffParams.marginleft) {
panel.spnMarginLeft.setRawValue("-");
}
if (this.diffParams.grid) {
panel.chPrintGrid.setValue("indeterminate");
}
if (this.diffParams.headings) {
panel.chPrintRows.setValue("indeterminate");
}
},
fillPageOptions: function (panel, props) {
var opt = props.asc_getPageSetup();
var index = panel.cmbPaperOrientation.getStore().find("orient", opt.asc_getOrientation());
panel.cmbPaperOrientation.select(panel.cmbPaperOrientation.getStore().getAt(index));
var w = opt.asc_getWidth();
var h = opt.asc_getHeight();
index = panel.cmbPaperSize.getStore().find("size", w + "|" + h);
if (index < 0) {
panel.cmbPaperSize.setValue("Custom (" + w + " x " + h);
} else {
panel.cmbPaperSize.select(panel.cmbPaperSize.getStore().getAt(index));
}
opt = props.asc_getPageMargins();
panel.spnMarginLeft.setValue(Common.MetricSettings.fnRecalcFromMM(opt.asc_getLeft()));
panel.spnMarginTop.setValue(Common.MetricSettings.fnRecalcFromMM(opt.asc_getTop()));
panel.spnMarginRight.setValue(Common.MetricSettings.fnRecalcFromMM(opt.asc_getRight()));
panel.spnMarginBottom.setValue(Common.MetricSettings.fnRecalcFromMM(opt.asc_getBottom()));
panel.chPrintGrid.setValue(props.asc_getGridLines());
panel.chPrintRows.setValue(props.asc_getHeadings());
},
fillPrintOptions: function (panel, props) {
panel.groupRange.setValue({
printrange: props.asc_getPrintType()
});
panel.groupLayout.setValue({
printlayout: props.asc_getLayoutPageType()
});
},
getPageOptions: function (panel) {
var props = new Asc.asc_CPageOptions();
props.asc_setGridLines(panel.chPrintGrid.getValue() == "indeterminate" ? undefined : panel.chPrintGrid.getValue() == "checked" ? 1 : 0);
props.asc_setHeadings(panel.chPrintRows.getValue() == "indeterminate" ? undefined : panel.chPrintRows.getValue() == "checked" ? 1 : 0);
var opt = new Asc.asc_CPageSetup();
opt.asc_setOrientation(panel.cmbPaperOrientation.getValue() == "-" ? undefined : panel.cmbPaperOrientation.getValue());
var pagew = /^\d{3}\.?\d*/.exec(panel.cmbPaperSize.getValue());
var pageh = /\d{3}\.?\d*$/.exec(panel.cmbPaperSize.getValue());
opt.asc_setWidth(!pagew ? undefined : parseFloat(pagew[0]));
opt.asc_setHeight(!pageh ? undefined : parseFloat(pageh[0]));
props.asc_setPageSetup(opt);
opt = new Asc.asc_CPageMargins();
opt.asc_setLeft(panel.spnMarginLeft.getRawValue() == "-" ? undefined : Common.MetricSettings.fnRecalcToMM(panel.spnMarginLeft.getNumberValue()));
opt.asc_setTop(panel.spnMarginTop.getRawValue() == "-" ? undefined : Common.MetricSettings.fnRecalcToMM(panel.spnMarginTop.getNumberValue()));
opt.asc_setRight(panel.spnMarginRight.getRawValue() == "-" ? undefined : Common.MetricSettings.fnRecalcToMM(panel.spnMarginRight.getNumberValue()));
opt.asc_setBottom(panel.spnMarginBottom.getRawValue() == "-" ? undefined : Common.MetricSettings.fnRecalcToMM(panel.spnMarginBottom.getNumberValue()));
props.asc_setPageMargins(opt);
return props;
},
savePageOptions: function (panel, index) {
var opts = this.getPageOptions(panel);
if (index == -255) {
var wc = this.api.asc_getWorksheetsCount();
index = -1;
while (++index < wc) {
this.api.asc_setPageOptions(opts, index);
}
if (this.diffParams.orientation) {
this.diffParams.orientation = opts.asc_getPageSetup().asc_getOrientation() == undefined;
}
if (this.diffParams.size) {
this.diffParams.size = (opts.asc_getPageSetup().asc_getWidth() == undefined || opts.asc_getPageSetup().asc_getHeight() == undefined);
}
if (this.diffParams.headings) {
this.diffParams.headings = opts.asc_getHeadings() == undefined;
}
if (this.diffParams.grid) {
this.diffParams.grid = opts.asc_getGridLines() == undefined;
}
if (this.diffParams.margintop) {
this.diffParams.margintop = opts.asc_getPageMargins().asc_getTop() == undefined;
}
if (this.diffParams.marginright) {
this.diffParams.marginright = opts.asc_getPageMargins().asc_getRight() == undefined;
}
if (this.diffParams.marginbottom) {
this.diffParams.marginbottom = opts.asc_getPageMargins().asc_getBottom() == undefined;
}
if (this.diffParams.marginleft) {
this.diffParams.marginleft = opts.asc_getPageMargins().asc_getLeft() == undefined;
}
} else {
this.api.asc_setPageOptions(opts, index);
this.diffParams = {};
}
},
openPrintSettings: function () {
if (this.api) {
var win = Ext.widget("sseprintsettings", {});
this.fillPageOptions(win, this.api.asc_getPageOptions());
this.fillPrintOptions(win, this.adjPrintParams);
win.updateMetricUnit();
win.show();
}
},
closePrintSettings: function (obj, mr) {
if (mr == 1) {
this.savePageOptions(obj, obj.groupRange.getValue().printrange == c_oAscPrintType.EntireWorkbook ? -255 : undefined);
this.adjPrintParams.asc_setPrintType(obj.groupRange.getValue().printrange);
this.adjPrintParams.asc_setLayoutPageType(obj.groupLayout.getValue().printlayout);
this.api.asc_Print(this.adjPrintParams);
this.isUpdatedSettings = false;
}
this.getToolbar().fireEvent("editcomplete", this.getToolbar());
},
querySavePrintSettings: function () {
var panel = this.getPrintAdvanced();
if (this.checkMargins(panel)) {
this.savePageOptions(panel, panel.cmbSheet.getValue());
panel.up("ssedocumentsettings").fireEvent("savedocsettings", panel);
}
},
queryClosePrintSettings: function (btn) {
var panel = btn.up("window");
if (this.checkMargins(panel)) {
panel.fireEvent("onmodalresult", panel, 1);
panel.close();
}
},
checkMargins: function (panel) {
if (panel.cmbPaperOrientation.getValue() == c_oAscPageOrientation.PagePortrait) {
var pagewidth = /^\d{3}\.?\d*/.exec(panel.cmbPaperSize.getValue());
var pageheight = /\d{3}\.?\d*$/.exec(panel.cmbPaperSize.getValue());
} else {
pageheight = /^\d{3}\.?\d*/.exec(panel.cmbPaperSize.getValue());
pagewidth = /\d{3}\.?\d*$/.exec(panel.cmbPaperSize.getValue());
}
var ml = Common.MetricSettings.fnRecalcToMM(panel.spnMarginLeft.getNumberValue());
var mr = Common.MetricSettings.fnRecalcToMM(panel.spnMarginRight.getNumberValue());
var mt = Common.MetricSettings.fnRecalcToMM(panel.spnMarginTop.getNumberValue());
var mb = Common.MetricSettings.fnRecalcToMM(panel.spnMarginBottom.getNumberValue());
var result = false;
if (ml > pagewidth) {
result = "left";
} else {
if (mr > pagewidth - ml) {
result = "right";
} else {
if (mt > pageheight) {
result = "top";
} else {
if (mb > pageheight - mt) {
result = "bottom";
}
}
}
}
if (result) {
Ext.Msg.show({
title: this.textWarning,
msg: this.warnCheckMargings,
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OK,
fn: function (btn, text) {
switch (result) {
case "left":
panel.spnMarginLeft.focus();
return;
case "right":
panel.spnMarginRight.focus();
return;
case "top":
panel.spnMarginTop.focus();
return;
case "bottom":
panel.spnMarginBottom.focus();
return;
}
}
});
return false;
}
return true;
},
warnCheckMargings: "Margins are incorrect",
strAllSheets: "All Sheets",
textWarning: "Warning"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "spreadsheeteditor/main/app/view/FileMenuPanels", "spreadsheeteditor/main/app/view/PrintSettings"], function () {
SSE.Controllers.Print = Backbone.Controller.extend(_.extend({
views: ["MainSettingsPrint"],
initialize: function () {
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this.adjPrintParams.asc_setPrintType(c_oAscPrintType.ActiveSheets);
this.adjPrintParams.asc_setLayoutPageType(c_oAscLayoutPageType.ActualSize);
this.diffParams = {};
this.addListeners({
"MainSettingsPrint": {
"show": _.bind(this.onShowMainSettingsPrint, this),
"render:after": _.bind(this.onAfterRender, this)
},
"Statusbar": {
"updatesheetsinfo": _.bind(function () {
if (this.printSettings.isVisible()) {
this.updateSettings();
} else {
this.isFillSheets = false;
this.diffParams = {};
}
},
this)
},
"PrintSettings": {
"changerange": _.bind(this.onChangeRange, this)
}
});
},
onLaunch: function () {
this.printSettings = this.createView("MainSettingsPrint");
},
onAfterRender: function (view) {
this.printSettings.cmbSheet.on("selected", _.bind(this.comboSheetsChange, this));
this.printSettings.btnOk.on("click", _.bind(this.querySavePrintSettings, this));
var toolbar = SSE.getController("Toolbar").getView("Toolbar");
if (toolbar) {
toolbar.mnuPrint.on("item:click", _.bind(this.openPrintSettings, this));
}
},
setApi: function (o) {
this.api = o;
},
updateSettings: function () {
var wc = this.api.asc_getWorksheetsCount(),
i = -1;
var items = [{
displayValue: this.strAllSheets,
value: -255
}];
while (++i < wc) {
if (!this.api.asc_isWorksheetHidden(i)) {
items.push({
displayValue: this.api.asc_getWorksheetName(i),
value: i
});
}
}
this.printSettings.cmbSheet.store.reset(items);
var item = this.printSettings.cmbSheet.store.findWhere({
value: this.printSettings.cmbSheet.getValue()
}) || this.printSettings.cmbSheet.store.findWhere({
value: this.api.asc_getActiveWorksheetIndex()
});
if (item) {
this.printSettings.cmbSheet.setValue(item.get("value"));
}
},
comboSheetsChange: function (combo, record) {
var newvalue = record.value;
if (newvalue == -255) {
this.indeterminatePageOptions(this.printSettings);
} else {
this.fillPageOptions(this.printSettings, this.api.asc_getPageOptions(newvalue));
}
},
isDiffRefill: function () {
for (var item in this.diffParams) {
if (this.diffParams[item] == undefined) {
return true;
}
}
return item == undefined;
},
indeterminatePageOptions: function (panel) {
if (this.isDiffRefill()) {
var wc = this.api.asc_getWorksheetsCount();
if (wc == 1) {
this.diffParams.orientation = false;
this.diffParams.size = false;
this.diffParams.headings = false;
this.diffParams.grid = false;
this.diffParams.margintop = false;
this.diffParams.marginright = false;
this.diffParams.marginbottom = false;
this.diffParams.marginleft = false;
} else {
var index = 0;
var opts = this.api.asc_getPageOptions(index),
opts_next;
while (++index < wc) {
opts_next = this.api.asc_getPageOptions(index);
if (this.diffParams.orientation == undefined) {
this.diffParams.orientation = opts.asc_getPageSetup().asc_getOrientation() != opts_next.asc_getPageSetup().asc_getOrientation();
}
if (this.diffParams.size == undefined) {
this.diffParams.size = (opts.asc_getPageSetup().asc_getWidth() != opts_next.asc_getPageSetup().asc_getWidth() || opts.asc_getPageSetup().asc_getHeight() != opts_next.asc_getPageSetup().asc_getHeight());
}
if (this.diffParams.headings == undefined) {
this.diffParams.headings = opts.asc_getHeadings() != opts_next.asc_getHeadings();
}
if (this.diffParams.grid == undefined) {
this.diffParams.grid = opts.asc_getGridLines() != opts_next.asc_getGridLines();
}
if (this.diffParams.margintop == undefined) {
this.diffParams.margintop = Math.abs(opts.asc_getPageMargins().asc_getTop() - opts_next.asc_getPageMargins().asc_getTop()) > 0.001;
}
if (this.diffParams.marginright == undefined) {
this.diffParams.marginright = Math.abs(opts.asc_getPageMargins().asc_getRight() - opts_next.asc_getPageMargins().asc_getRight()) > 0.001;
}
if (this.diffParams.marginbottom == undefined) {
this.diffParams.marginbottom = Math.abs(opts.asc_getPageMargins().asc_getBottom() - opts_next.asc_getPageMargins().asc_getBottom()) > 0.001;
}
if (this.diffParams.marginleft == undefined) {
this.diffParams.marginleft = Math.abs(opts.asc_getPageMargins().asc_getLeft() - opts_next.asc_getPageMargins().asc_getLeft()) > 0.001;
}
}
}
}
if (this.diffParams.orientation) {
panel.cmbPaperOrientation.setValue("-");
}
if (this.diffParams.size) {
panel.cmbPaperSize.setValue("-");
}
if (this.diffParams.margintop) {
panel.spnMarginTop.setValue("-");
}
if (this.diffParams.marginright) {
panel.spnMarginRight.setValue("-");
}
if (this.diffParams.marginbottom) {
panel.spnMarginBottom.setValue("-");
}
if (this.diffParams.marginleft) {
panel.spnMarginLeft.setValue("-");
}
if (this.diffParams.grid) {
panel.chPrintGrid.setValue("indeterminate");
}
if (this.diffParams.headings) {
panel.chPrintRows.setValue("indeterminate");
}
},
fillPageOptions: function (panel, props) {
var opt = props.asc_getPageSetup();
var item = panel.cmbPaperOrientation.store.findWhere({
value: opt.asc_getOrientation()
});
if (item) {
panel.cmbPaperOrientation.setValue(item.get("value"));
}
var w = opt.asc_getWidth();
var h = opt.asc_getHeight();
item = panel.cmbPaperSize.store.findWhere({
value: w + "|" + h
});
if (item) {
panel.cmbPaperSize.setValue(item.get("value"));
} else {
panel.cmbPaperSize.setValue("Custom (" + w + " x " + h);
}
opt = props.asc_getPageMargins();
panel.spnMarginLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(opt.asc_getLeft()));
panel.spnMarginTop.setValue(Common.Utils.Metric.fnRecalcFromMM(opt.asc_getTop()));
panel.spnMarginRight.setValue(Common.Utils.Metric.fnRecalcFromMM(opt.asc_getRight()));
panel.spnMarginBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(opt.asc_getBottom()));
panel.chPrintGrid.setValue(props.asc_getGridLines());
panel.chPrintRows.setValue(props.asc_getHeadings());
},
fillPrintOptions: function (panel, props) {
panel.setRange(props.asc_getPrintType());
},
getPageOptions: function (panel) {
var props = new Asc.asc_CPageOptions();
props.asc_setGridLines(panel.chPrintGrid.getValue() == "indeterminate" ? undefined : panel.chPrintGrid.getValue() == "checked" ? 1 : 0);
props.asc_setHeadings(panel.chPrintRows.getValue() == "indeterminate" ? undefined : panel.chPrintRows.getValue() == "checked" ? 1 : 0);
var opt = new Asc.asc_CPageSetup();
opt.asc_setOrientation(panel.cmbPaperOrientation.getValue() == "-" ? undefined : panel.cmbPaperOrientation.getValue());
var pagew = /^\d{3}\.?\d*/.exec(panel.cmbPaperSize.getValue());
var pageh = /\d{3}\.?\d*$/.exec(panel.cmbPaperSize.getValue());
opt.asc_setWidth(!pagew ? undefined : parseFloat(pagew[0]));
opt.asc_setHeight(!pageh ? undefined : parseFloat(pageh[0]));
props.asc_setPageSetup(opt);
opt = new Asc.asc_CPageMargins();
opt.asc_setLeft(panel.spnMarginLeft.getValue() == "-" ? undefined : Common.Utils.Metric.fnRecalcToMM(panel.spnMarginLeft.getNumberValue()));
opt.asc_setTop(panel.spnMarginTop.getValue() == "-" ? undefined : Common.Utils.Metric.fnRecalcToMM(panel.spnMarginTop.getNumberValue()));
opt.asc_setRight(panel.spnMarginRight.getValue() == "-" ? undefined : Common.Utils.Metric.fnRecalcToMM(panel.spnMarginRight.getNumberValue()));
opt.asc_setBottom(panel.spnMarginBottom.getValue() == "-" ? undefined : Common.Utils.Metric.fnRecalcToMM(panel.spnMarginBottom.getNumberValue()));
props.asc_setPageMargins(opt);
return props;
},
savePageOptions: function (panel, index) {
var opts = this.getPageOptions(panel);
if (index == -255) {
var wc = this.api.asc_getWorksheetsCount();
index = -1;
while (++index < wc) {
this.api.asc_setPageOptions(opts, index);
}
if (this.diffParams.orientation) {
this.diffParams.orientation = opts.asc_getPageSetup().asc_getOrientation() == undefined;
}
if (this.diffParams.size) {
this.diffParams.size = (opts.asc_getPageSetup().asc_getWidth() == undefined || opts.asc_getPageSetup().asc_getHeight() == undefined);
}
if (this.diffParams.headings) {
this.diffParams.headings = opts.asc_getHeadings() == undefined;
}
if (this.diffParams.grid) {
this.diffParams.grid = opts.asc_getGridLines() == undefined;
}
if (this.diffParams.margintop) {
this.diffParams.margintop = opts.asc_getPageMargins().asc_getTop() == undefined;
}
if (this.diffParams.marginright) {
this.diffParams.marginright = opts.asc_getPageMargins().asc_getRight() == undefined;
}
if (this.diffParams.marginbottom) {
this.diffParams.marginbottom = opts.asc_getPageMargins().asc_getBottom() == undefined;
}
if (this.diffParams.marginleft) {
this.diffParams.marginleft = opts.asc_getPageMargins().asc_getLeft() == undefined;
}
} else {
this.api.asc_setPageOptions(opts, index);
this.diffParams = {};
}
},
onShowMainSettingsPrint: function () {
if (!this.isFillSheets) {
this.isFillSheets = true;
this.updateSettings();
}
if (!this.isUpdatedSettings) {
this.isUpdatedSettings = true;
var item = this.printSettings.cmbSheet.store.findWhere({
value: this.api.asc_getActiveWorksheetIndex()
});
if (item) {
this.printSettings.cmbSheet.setValue(item.get("value"));
this.comboSheetsChange(this.printSettings.cmbSheet, item.toJSON());
}
}
},
openPrintSettings: function (menu, item) {
if (item.value === "options" && this.api) {
this.printSettingsDlg = (new SSE.Views.PrintSettings({
handler: _.bind(this.resultPrintSettings, this),
afterrender: _.bind(function () {
this.fillPageOptions(this.printSettingsDlg, this.api.asc_getPageOptions());
this.fillPrintOptions(this.printSettingsDlg, this.adjPrintParams);
},
this)
}));
this.printSettingsDlg.show();
}
},
resultPrintSettings: function (result, value) {
var view = SSE.getController("Toolbar").getView("Toolbar");
if (result == "ok") {
if (this.checkMargins(this.printSettingsDlg)) {
this.savePageOptions(this.printSettingsDlg, this.printSettingsDlg.getRange() == c_oAscPrintType.EntireWorkbook ? -255 : undefined);
this.adjPrintParams.asc_setPrintType(this.printSettingsDlg.getRange());
this.api.asc_Print(this.adjPrintParams);
this.isUpdatedSettings = false;
} else {
return true;
}
}
Common.NotificationCenter.trigger("edit:complete", view);
},
onChangeRange: function () {
var newvalue = this.printSettingsDlg.getRange();
if (newvalue == c_oAscPrintType.EntireWorkbook) {
this.indeterminatePageOptions(this.printSettingsDlg);
} else {
if (this.lastCheckedRange == c_oAscPrintType.EntireWorkbook) {
this.fillPageOptions(this.printSettingsDlg, this.api.asc_getPageOptions());
}
}
this.lastCheckedRange = newvalue;
},
querySavePrintSettings: function () {
if (this.checkMargins(this.printSettings)) {
this.savePageOptions(this.printSettings, this.printSettings.cmbSheet.getValue());
this.printSettings.applySettings();
}
},
checkMargins: function (panel) {
if (panel.cmbPaperOrientation.getValue() == c_oAscPageOrientation.PagePortrait) {
var pagewidth = /^\d{3}\.?\d*/.exec(panel.cmbPaperSize.getValue());
var pageheight = /\d{3}\.?\d*$/.exec(panel.cmbPaperSize.getValue());
} else {
pageheight = /^\d{3}\.?\d*/.exec(panel.cmbPaperSize.getValue());
pagewidth = /\d{3}\.?\d*$/.exec(panel.cmbPaperSize.getValue());
}
pagewidth = parseFloat(pagewidth[0]);
pageheight = parseFloat(pageheight[0]);
var ml = Common.Utils.Metric.fnRecalcToMM(panel.spnMarginLeft.getNumberValue());
var mr = Common.Utils.Metric.fnRecalcToMM(panel.spnMarginRight.getNumberValue());
var mt = Common.Utils.Metric.fnRecalcToMM(panel.spnMarginTop.getNumberValue());
var mb = Common.Utils.Metric.fnRecalcToMM(panel.spnMarginBottom.getNumberValue());
var result = false;
if (ml > pagewidth) {
result = "left";
} else {
if (mr > pagewidth - ml) {
result = "right";
} else {
if (mt > pageheight) {
result = "top";
} else {
if (mb > pageheight - mt) {
result = "bottom";
}
}
}
}
if (result) {
Common.UI.warning({
title: this.textWarning,
msg: this.warnCheckMargings,
callback: function (btn, text) {
switch (result) {
case "left":
panel.spnMarginLeft.$el.focus();
return;
case "right":
panel.spnMarginRight.$el.focus();
return;
case "top":
panel.spnMarginTop.$el.focus();
return;
case "bottom":
panel.spnMarginBottom.$el.focus();
return;
}
}
});
return false;
}
return true;
},
warnCheckMargings: "Margins are incorrect",
strAllSheets: "All Sheets",
textWarning: "Warning"
},
SSE.Controllers.Print || {}));
});

View File

@@ -0,0 +1,257 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "spreadsheeteditor/main/app/view/RightMenu"], function () {
SSE.Controllers.RightMenu = Backbone.Controller.extend({
models: [],
collections: [],
views: ["RightMenu"],
initialize: function () {
this.editMode = true;
this._state = {};
this.addListeners({
"RightMenu": {
"rightmenuclick": this.onRightMenuClick
}
});
},
onLaunch: function () {
this.rightmenu = this.createView("RightMenu");
this.rightmenu.on("render:after", _.bind(this.onRightMenuAfterRender, this));
},
onRightMenuAfterRender: function (rightMenu) {
rightMenu.shapeSettings.application = this.getApplication();
this._settings = [];
this._settings[c_oAscTypeSelectElement.Paragraph] = {
panelId: "id-paragraph-settings",
panel: rightMenu.paragraphSettings,
btn: rightMenu.btnText,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Image] = {
panelId: "id-image-settings",
panel: rightMenu.imageSettings,
btn: rightMenu.btnImage,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Shape] = {
panelId: "id-shape-settings",
panel: rightMenu.shapeSettings,
btn: rightMenu.btnShape,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Chart] = {
panelId: "id-chart-settings",
panel: rightMenu.chartSettings,
btn: rightMenu.btnChart,
hidden: 1,
locked: false
};
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onCoAuthoringDisconnect, this));
},
setMode: function (mode) {
this.editMode = mode.isEdit;
},
onRightMenuClick: function (menu, type, minimized) {
if (!minimized && this.editMode) {
var panel = this._settings[type].panel;
var props = this._settings[type].props;
if (props && panel) {
panel.ChangeSettings.call(panel, props);
}
}
Common.NotificationCenter.trigger("layout:changed", "rightmenu");
Common.NotificationCenter.trigger("edit:complete", this.rightmenu);
},
onSelectionChanged: function (info) {
var SelectedObjects = [],
selectType = info.asc_getFlags().asc_getSelectionType();
if (selectType == c_oAscSelectionType.RangeImage || selectType == c_oAscSelectionType.RangeShape || selectType == c_oAscSelectionType.RangeChart || selectType == c_oAscSelectionType.RangeChartText || selectType == c_oAscSelectionType.RangeShapeText) {
SelectedObjects = this.api.asc_getGraphicObjectProps();
}
if (SelectedObjects.length <= 0 && !this.rightmenu.minimizedMode) {
this.rightmenu.clearSelection();
}
this.onFocusObject(SelectedObjects);
var need_disable = info.asc_getLocked(),
me = this;
if (this._state.prevDisabled != need_disable) {
this._state.prevDisabled = need_disable;
_.each(this._settings, function (item) {
item.panel.setLocked(need_disable);
});
}
},
onFocusObject: function (SelectedObjects) {
if (!this.editMode) {
return;
}
for (var i = 0; i < this._settings.length; ++i) {
if (this._settings[i]) {
this._settings[i].hidden = 1;
this._settings[i].locked = false;
}
}
for (i = 0; i < SelectedObjects.length; ++i) {
var type = SelectedObjects[i].asc_getObjectType();
if (type >= this._settings.length || this._settings[type] === undefined) {
continue;
}
var value = SelectedObjects[i].asc_getObjectValue();
if (type == c_oAscTypeSelectElement.Image) {
if (value.asc_getChartProperties() !== null) {
type = c_oAscTypeSelectElement.Chart;
} else {
if (value.asc_getShapeProperties() !== null) {
type = c_oAscTypeSelectElement.Shape;
}
}
}
this._settings[type].props = value;
this._settings[type].hidden = 0;
this._settings[type].locked = value.asc_getLocked();
}
var lastactive = -1,
currentactive, priorityactive = -1;
for (i = 0; i < this._settings.length; ++i) {
var pnl = this._settings[i];
if (pnl === undefined) {
continue;
}
if (pnl.hidden) {
if (!pnl.btn.isDisabled()) {
pnl.btn.setDisabled(true);
}
if (this.rightmenu.GetActivePane() == pnl.panelId) {
currentactive = -1;
}
} else {
if (pnl.btn.isDisabled()) {
pnl.btn.setDisabled(false);
}
lastactive = i;
if (pnl.needShow) {
pnl.needShow = false;
priorityactive = i;
} else {
if (this.rightmenu.GetActivePane() == pnl.panelId) {
currentactive = i;
}
}
pnl.panel.setLocked(pnl.locked);
}
}
if (!this.rightmenu.minimizedMode) {
var active;
if (priorityactive > -1) {
active = priorityactive;
} else {
if (lastactive >= 0 && currentactive < 0) {
active = lastactive;
} else {
if (currentactive >= 0) {
active = currentactive;
}
}
}
if (active !== undefined) {
this.rightmenu.SetActivePane(active);
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
}
}
this._settings[c_oAscTypeSelectElement.Image].needShow = false;
this._settings[c_oAscTypeSelectElement.Chart].needShow = false;
},
onCoAuthoringDisconnect: function () {
if (this.rightmenu) {
this.rightmenu.SetDisabled("", true, true);
}
this.setMode({
isEdit: false
});
},
onInsertImage: function () {
this._settings[c_oAscTypeSelectElement.Image].needShow = true;
},
onInsertChart: function () {
this._settings[c_oAscTypeSelectElement.Chart].needShow = true;
},
onInsertShape: function () {
this._settings[c_oAscTypeSelectElement.Shape].needShow = true;
},
UpdateThemeColors: function () {
this.rightmenu.shapeSettings.UpdateThemeColors();
},
updateMetricUnit: function () {
this.rightmenu.paragraphSettings.updateMetricUnit();
this.rightmenu.chartSettings.updateMetricUnit();
this.rightmenu.imageSettings.updateMetricUnit();
},
createDelayedElements: function () {
var me = this;
if (this.api) {
this.api.asc_registerCallback("asc_onFocusObject", _.bind(this.onFocusObject, this));
this.api.asc_registerCallback("asc_onSelectionChanged", _.bind(this.onSelectionChanged, this));
this.api.asc_registerCallback("asc_doubleClickOnObject", _.bind(this.onDoubleClickOnObject, this));
}
},
onDoubleClickOnObject: function (obj) {
if (!this.editMode) {
return;
}
var type = obj.asc_getObjectType();
if (type >= this._settings.length || this._settings[type] === undefined) {
return;
}
var value = obj.asc_getObjectValue();
if (type == c_oAscTypeSelectElement.Image) {
if (value.asc_getChartProperties() !== null) {
type = c_oAscTypeSelectElement.Chart;
} else {
if (value.asc_getShapeProperties() !== null) {
type = c_oAscTypeSelectElement.Shape;
}
}
}
if (type !== c_oAscTypeSelectElement.Paragraph) {
this.rightmenu.SetActivePane(type, true);
this._settings[type].panel.ChangeSettings.call(this._settings[type].panel, this._settings[type].props);
}
}
});
});

View File

@@ -1,193 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Search", {
extend: "Ext.app.Controller",
refs: [{
ref: "searchDialog",
selector: "commonsearchdialog"
},
{
ref: "searchQuery",
selector: "#search-dialog-text-search"
},
{
ref: "replaceQuery",
selector: "#search-dialog-text-replace"
}],
init: function () {
var me = this;
this.control({
"commonsearchdialog": {
show: function () {
me.api.asc_closeCellEditor();
me.setDefaultView();
}
},
"commonsearchdialog button[group=search-text]": {
click: function (btn) {
this._startSearch(btn.direction);
}
},
"commonsearchdialog button[group=replace-text]": {
click: this.btnReplaceText
},
"#search-dialog-text-search": {
searchstart: function (obj, text) {
this._startSearch("next");
obj.stopSearch(true);
}
},
"ssemainmenu #main-menu-search": {
toggle: this.showSearchDialog
}
});
},
setMode: function (mode) {
this.mode = mode;
this._frmSearch && this._frmSearch.setViewMode(!this.mode.isEdit);
},
setApi: function (o) {
this.api = o;
this.api.asc_registerCallback("asc_onRenameCellTextEnd", Ext.bind(this._onRenameText, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
},
setDefaultView: function () {
this.getSearchDialog().searchMode();
},
showWarning: function (text) {
var me = this;
if (!this.msgbox) {
this.msgbox = Ext.create("Ext.window.MessageBox", {
listeners: {
beforehide: function () {
me.getSearchQuery().focus(true, 100);
}
}
});
}
var config = {
title: this.textSearch,
msg: text,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
};
if (Common.userAgent.isIE) {
var oldFn = {
enter: Ext.FocusManager.navigateIn,
esc: Ext.FocusManager.navigateOut
};
Ext.FocusManager.navigateIn = Ext.emptyFn;
Ext.FocusManager.navigateOut = function (event) {
me.msgbox.close();
};
config.fn = function (btn) {
Ext.FocusManager.navigateIn = oldFn.enter;
Ext.FocusManager.navigateOut = oldFn.esc;
};
}
this.msgbox.show(config);
},
btnReplaceText: function (btn, event, opts) {
var me = this;
if (me.getSearchQuery().isValueValid()) {
var sett = this.getSearchDialog().getSettings();
this.api.isReplaceAll = (btn.type == "all");
this.api.asc_replaceText(sett.textsearch, sett.textreplace, btn.type == "all", sett.casesensitive, sett.wholewords);
}
},
_startSearch: function (direction) {
if (this.api && this.getSearchQuery().isValueValid()) {
var sett = this.getSearchDialog().getSettings();
if (!this.api.asc_findText(sett.textsearch, true, direction == "next", sett.casesensitive, sett.wholewords)) {
this.showWarning(this.textNoTextFound);
}
}
},
_onRenameText: function (found, replaced) {
var me = this;
if (this.api.isReplaceAll) {
if (found) {
if (! (found - replaced)) {
me.showWarning(Ext.String.format(this.textReplaceSuccess, replaced));
} else {
me.showWarning(Ext.String.format(this.textReplaceSkipped, found - replaced));
}
} else {
me.showWarning(me.textNoTextFound);
}
} else {
var sett = this.getSearchDialog().getSettings();
if (!me.api.asc_findText(sett.textsearch, true, true, sett.casesensitive, sett.wholewords)) {
me.showWarning(me.textNoTextFound);
}
}
},
showSearchDialog: function (btn, pressed) {
if (pressed) {
var mainmenu = btn.up("#view-main-menu");
mainmenu.closeFullScaleMenu();
var me = this;
if (!me._frmSearch) {
me._frmSearch = Ext.create("Common.view.SearchDialog", {
animateTarget: "main-menu-search",
closeAction: "hide",
isViewMode: !me.mode.isEdit,
highlight: false,
listeners: {
hide: function (cnt, eOpts) {
if (!btn.ownrise) {
btn.ownrise = true;
btn.toggle(false, true);
mainmenu.fireEvent("editcomplete", mainmenu);
}
btn.ownrise = false;
}
}
});
}
me._frmSearch.show();
} else {
if (this._frmSearch && !btn.ownrise) {
btn.ownrise = true;
this._frmSearch.hide();
}
}
},
onCoAuthoringDisconnect: function () {
this.mode.isEdit = false;
this._frmSearch && this._frmSearch.setViewMode(true);
},
textSearch: "Search",
textNoTextFound: "Text not found",
textReplaceSuccess: "Search has been done. {0} occurrences have been replaced",
textReplaceSkipped: "The replacement has been made. {0} occurrences were skipped."
});

View File

@@ -0,0 +1,583 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "spreadsheeteditor/main/app/view/Statusbar"], function () {
SSE.Controllers.Statusbar = Backbone.Controller.extend(_.extend({
models: [],
collections: [],
views: ["Statusbar"],
initialize: function () {
this.addListeners({
"Statusbar": {
"show:hidden": _.bind(function (obj, index) {
this.hideWorksheet(false, index);
},
this),
"sheet:changename": _.bind(function () {
this.api.asc_closeCellEditor();
this.renameWorksheet();
},
this),
"sheet:setcolor": _.bind(this.setWorksheetColor, this),
"sheet:updateColors": _.bind(this.updateTabsColors, this),
"sheet:move": _.bind(this.moveWorksheet, this)
}
});
var me = this;
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
"alt+pageup": function (e) {
me.moveCurrentTab(-1);
e.preventDefault();
e.stopPropagation();
},
"alt+pagedown": function (e) {
me.moveCurrentTab(1);
e.preventDefault();
e.stopPropagation();
}
}
});
},
events: function () {
return {
"click #status-btn-zoomdown": _.bind(this.zoomDocument, this, "down"),
"click #status-btn-zoomup": _.bind(this.zoomDocument, this, "up"),
"click .cnt-zoom": _.bind(this.onZoomShow, this)
};
},
onLaunch: function () {
this.statusbar = this.createView("Statusbar").render();
this.statusbar.$el.css("z-index", 10);
this.statusbar.labelZoom.css("min-width", 70);
this.statusbar.zoomMenu.on("item:click", _.bind(this.menuZoomClick, this));
this.bindViewEvents(this.statusbar, this.events);
$("#id-tab-menu-new-color").on("click", _.bind(this.onNewBorderColor, this));
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onZoomChanged", _.bind(this.onZoomChange, this));
this.api.asc_registerCallback("asc_onSelectionMathChanged", _.bind(this.onApiMathChanged, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onApiDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onApiDisconnect, this));
this.api.asc_registerCallback("asc_onUpdateTabColor", _.bind(this.onApiUpdateTabColor, this));
this.api.asc_registerCallback("asc_onEditCell", _.bind(this.onApiEditCell, this));
this.api.asc_registerCallback("asc_onWorkbookLocked", _.bind(this.onWorkbookLocked, this));
this.api.asc_registerCallback("asc_onWorksheetLocked", _.bind(this.onWorksheetLocked, this));
this.api.asc_registerCallback("asc_onAuthParticipantsChanged", _.bind(this.onApiUsersChanged, this));
this.api.asc_registerCallback("asc_onParticipantsChanged", _.bind(this.onApiUsersChanged, this));
this.api.asc_coAuthoringGetUsers();
this.statusbar.setApi(api);
},
zoomDocument: function (d, e) {
switch (d) {
case "up":
var f = this.api.asc_getZoom() + 0.1; ! (f > 2) && this.api.asc_setZoom(f);
break;
case "down":
f = this.api.asc_getZoom() - 0.1; ! (f < 0.5) && this.api.asc_setZoom(f);
break;
}
},
menuZoomClick: function (menu, item) {
this.api.asc_setZoom(item.value / 100);
},
onZoomChange: function (percent, type) {
this.statusbar.labelZoom.text(Common.Utils.String.format(this.zoomText, Math.floor((percent + 0.005) * 100)));
},
onApiDisconnect: function () {
this.statusbar.setMode({
isDisconnected: true
});
this.statusbar.update();
},
onWorkbookLocked: function (locked) {
this.statusbar.tabbar[locked ? "addClass" : "removeClass"]("coauth-locked");
this.statusbar.btnAddWorksheet.setDisabled(locked || this.statusbar.rangeSelectionMode == c_oAscSelectionDialogType.Chart || this.statusbar.rangeSelectionMode == c_oAscSelectionDialogType.FormatTable);
var item, i = this.statusbar.tabbar.getCount();
while (i-->0) {
item = this.statusbar.tabbar.getAt(i);
if (item.sheetindex >= 0) {} else {
item.disable(locked);
}
}
},
onWorksheetLocked: function (index, locked) {
var count = this.statusbar.tabbar.getCount(),
tab;
for (var i = count; i-->0;) {
tab = this.statusbar.tabbar.getAt(i);
if (index == tab.sheetindex) {
tab[locked ? "addClass" : "removeClass"]("coauth-locked");
tab.isLockTheDrag = locked || (this.statusbar.rangeSelectionMode == c_oAscSelectionDialogType.FormatTable);
break;
}
}
},
onApiUsersChanged: function (users) {
var editusers = [];
_.each(users, function (item) {
if (!item.asc_getView()) {
editusers.push(item);
}
});
var length = _.size(editusers);
var panel = this.statusbar.panelUsers;
panel[length > 1 ? "show" : "hide"]();
this.statusbar.updateTabbarBorders();
var ttblock = panel.find("#status-users-block");
if (ttblock.data("bs.tooltip")) {
ttblock.removeData("bs.tooltip");
}
if (length > 1) {
panel.find("#status-users-count").text(length);
var tip = this.tipUsers + "<br/><br/>",
i = 0;
for (var n in editusers) {
tip += "\n" + Common.Utils.String.htmlEncode(editusers[n].asc_getUserName());
if (++i > 3) {
break;
}
}
if (length > 4) {
tip += "<br/>" + this.tipMoreUsers.replace("%1", length - 4);
tip += "<br/><br/>" + this.tipShowUsers;
}
ttblock.tooltip({
title: tip,
html: true,
placement: "top"
});
}
},
onApiMathChanged: function (info) {
this.statusbar.setMathInfo({
count: info.asc_getCount(),
average: info.asc_getAverage(),
sum: info.asc_getSum()
});
this.statusbar.updateTabbarBorders();
},
onApiEditCell: function (state) {
var disable = state != c_oAscCellEditorState.editEnd;
this.statusbar.btnZoomUp.setDisabled(disable);
this.statusbar.btnZoomDown.setDisabled(disable);
this.statusbar.labelZoom[disable ? "addClass" : "removeClass"]("disabled");
},
createDelayedElements: function () {
this.statusbar.$el.css("z-index", "");
this.statusbar.tabMenu.on("item:click", _.bind(this.onTabMenu, this));
this.statusbar.btnAddWorksheet.on("click", _.bind(this.onAddWorksheetClick, this));
Common.NotificationCenter.on("window:resize", _.bind(this.onWindowResize, this));
Common.NotificationCenter.on("cells:range", _.bind(this.onRangeDialogMode, this));
},
onWindowResize: function (area) {
this.statusbar.onTabInvisible(undefined, this.statusbar.tabbar.checkInvisible(true));
},
onRangeDialogMode: function (mode) {
var islocked = this.statusbar.tabbar.hasClass("coauth-locked"),
currentIdx = this.api.asc_getActiveWorksheetIndex();
this.statusbar.btnAddWorksheet.setDisabled(islocked || mode != c_oAscSelectionDialogType.None);
var item, i = this.statusbar.tabbar.getCount();
while (i-->0) {
item = this.statusbar.tabbar.getAt(i);
if (item.sheetindex !== currentIdx) {
item.disable(mode == c_oAscSelectionDialogType.FormatTable);
}
item.isLockTheDrag = (item.hasClass("coauth-locked") || (mode != c_oAscSelectionDialogType.None));
}
this.statusbar.rangeSelectionMode = mode;
},
onTabMenu: function (obj, item, e) {
switch (item.value) {
case "ins":
this.api.asc_insertWorksheet(this.createSheetName());
break;
case "del":
this.deleteWorksheet();
break;
case "ren":
this.renameWorksheet();
break;
case "copy":
this.moveWorksheet(false);
break;
case "move":
this.moveWorksheet(true);
break;
case "hide":
this.hideWorksheet(true);
break;
}
},
createSheetName: function () {
var items = [],
wc = this.api.asc_getWorksheetsCount();
while (wc--) {
items.push(this.api.asc_getWorksheetName(wc).toLowerCase());
}
var index = 0,
name;
while (++index < 1000) {
name = this.strSheet + index;
if (items.indexOf(name.toLowerCase()) < 0) {
break;
}
}
return name;
},
createCopyName: function (orig) {
var wc = this.api.asc_getWorksheetsCount(),
names = [];
while (wc--) {
names.push(this.api.asc_getWorksheetName(wc).toLowerCase());
}
var re = /^(.*)\((\d)\)$/.exec(orig);
var first = re ? re[1] : orig + " ";
var index = 1,
name;
while (++index < 1000) {
name = first + "(" + index + ")";
if (names.indexOf(name.toLowerCase()) < 0) {
break;
}
}
return name;
},
deleteWorksheet: function () {
var me = this;
if (this.statusbar.tabbar.tabs.length == 1) {
Common.UI.warning({
msg: this.errorLastSheet
});
} else {
Common.UI.warning({
msg: this.warnDeleteSheet,
buttons: ["ok", "cancel"],
callback: function (btn) {
if (btn == "ok" && !me.api.asc_deleteWorksheet()) {
_.delay(function () {
Common.UI.error({
msg: me.errorRemoveSheet
});
},
10);
}
}
});
}
},
hideWorksheet: function (hide, index) {
if (hide) {
this.statusbar.tabbar.tabs.length == 1 ? Common.UI.warning({
msg: this.errorLastSheet
}) : this.api["asc_hideWorksheet"](index);
} else {
this.api["asc_showWorksheet"](index);
this.loadTabColor(index);
}
},
renameWorksheet: function () {
var me = this;
var wc = me.api.asc_getWorksheetsCount(),
items = [];
if (wc > 0) {
var sindex = me.api.asc_getActiveWorksheetIndex();
if (me.api.asc_isWorksheetLockedOrDeleted(sindex)) {
return;
}
while (wc--) {
if (sindex !== wc) {
items.push(me.api.asc_getWorksheetName(wc).toLowerCase());
}
}
var tab = me.statusbar.tabbar.tabs[this.statusbar.tabbar.getActive()];
var top = me.statusbar.$el.position().top - 115,
left = tab.$el.offset().left;
var current = me.api.asc_getWorksheetName(me.api.asc_getActiveWorksheetIndex());
(new SSE.Views.Statusbar.RenameDialog({
current: current,
names: items,
handler: function (btn, s) {
if (btn == "ok" && s != current) {
me.api.asc_renameWorksheet(s);
tab.setCaption(s);
me.statusbar.fireEvent("updatesheetsinfo", me.statusbar);
}
me.api.asc_enableKeyEvents(true);
}
})).show(left, top);
}
},
moveWorksheet: function (cut, silent, index, destPos) {
var me = this;
var wc = me.api.asc_getWorksheetsCount(),
items = [],
i = -1;
while (++i < wc) {
if (!this.api.asc_isWorksheetHidden(i)) {
items.push({
value: me.api.asc_getWorksheetName(i),
inindex: i
});
}
}
if (!_.isUndefined(silent)) {
me.api.asc_showWorksheet(items[index].inindex);
Common.NotificationCenter.trigger("comments:updatefilter", {
property: "uid",
value: new RegExp("^(doc_|sheet" + this.api.asc_getActiveWorksheetId() + "_)")
});
if (!_.isUndefined(destPos)) {
me.api.asc_moveWorksheet(items.length === destPos ? wc : items[destPos].inindex);
}
return;
} (new SSE.Views.Statusbar.CopyDialog({
title: cut ? me.statusbar.itemMove : me.statusbar.itemCopy,
ismove: cut,
names: items,
handler: function (btn, i) {
if (btn == "ok") {
if (cut) {
me.api.asc_moveWorksheet(i == -255 ? wc : i);
} else {
var new_text = me.createCopyName(me.api.asc_getWorksheetName(me.api.asc_getActiveWorksheetIndex()));
me.api.asc_copyWorksheet(i == -255 ? wc : i, new_text);
}
}
me.api.asc_enableKeyEvents(true);
}
})).show();
},
onAddWorksheetClick: function (o, index, opts) {
if (this.api) {
this.api.asc_closeCellEditor();
this.api.asc_addWorksheet(this.createSheetName());
Common.NotificationCenter.trigger("comments:updatefilter", {
property: "uid",
value: new RegExp("^(doc_|sheet" + this.api.asc_getActiveWorksheetId() + "_)")
},
false);
}
Common.NotificationCenter.trigger("edit:complete", this.statusbar);
},
selectTab: function (sheetindex) {
if (this.api) {
var hidden = this.api.asc_isWorksheetHidden(sheetindex);
if (!hidden) {
var tab = _.findWhere(this.statusbar.tabbar.tabs, {
sheetindex: sheetindex
});
if (tab) {
this.statusbar.tabbar.setActive(tab);
}
}
}
},
moveCurrentTab: function (direction) {
if (this.api) {
var indTab = 0,
tabBar = this.statusbar.tabbar,
index = this.api.asc_getActiveWorksheetIndex(),
length = tabBar.tabs.length;
this.statusbar.tabMenu.hide();
this.api.asc_closeCellEditor();
for (var i = 0; i < length; ++i) {
if (tabBar.tabs[i].sheetindex === index) {
indTab = i;
if (direction > 0) {
indTab++;
if (indTab >= length) {
indTab = 0;
}
} else {
indTab--;
if (indTab < 0) {
indTab = length - 1;
}
}
tabBar.setActive(indTab);
this.api.asc_showWorksheet(tabBar.getAt(indTab).sheetindex);
break;
}
}
}
},
onApiUpdateTabColor: function (index) {
this.loadTabColor(index);
},
setWorksheetColor: function (color) {
if (this.api) {
var sindex = this.api.asc_getActiveWorksheetIndex();
var tab = _.findWhere(this.statusbar.tabbar.tabs, {
sheetindex: sindex
});
if (tab) {
if ("transparent" === color) {
this.api.asc_setWorksheetTabColor(sindex, null);
tab.$el.find("a").css("box-shadow", "");
} else {
var asc_clr = Common.Utils.ThemeColor.getRgbColor(color);
if (asc_clr) {
this.api.asc_setWorksheetTabColor(sindex, asc_clr);
this.setTabLineColor(tab, asc_clr);
}
}
}
}
},
updateThemeColors: function () {
var updateColors = function (picker, defaultColorIndex) {
if (picker) {
var clr, effectcolors = Common.Utils.ThemeColor.getEffectColors();
for (var i = 0; i < effectcolors.length; ++i) {
if (typeof(picker.currentColor) == "object" && clr === undefined && picker.currentColor.effectId == effectcolors[i].effectId) {
clr = effectcolors[i];
}
}
picker.updateColors(effectcolors, Common.Utils.ThemeColor.getStandartColors());
if (picker.currentColor === undefined) {
picker.currentColor = effectcolors[defaultColorIndex];
} else {
if (clr !== undefined) {
picker.currentColor = clr;
}
}
}
};
if (this.statusbar) {
updateColors(this.statusbar.mnuTabColor, 1);
}
},
onNewBorderColor: function () {
if (this.statusbar && this.statusbar.mnuTabColor) {
this.statusbar.mnuTabColor.addNewColor();
}
},
updateTabsColors: function (updateCurrentColor) {
var i = -1,
tabind = -1,
color = null,
clr = null,
ishidden = false,
wc = this.api.asc_getWorksheetsCount(),
sindex = this.api.asc_getActiveWorksheetIndex();
if (!_.isUndefined(updateCurrentColor)) {
var toolbarController = this.application.getController("Toolbar");
if (toolbarController) {
this.statusbar.mnuTabColor.updateCustomColors();
color = this.api.asc_getWorksheetTabColor(sindex);
if (color) {
if (color.get_type() == c_oAscColor.COLOR_TYPE_SCHEME) {
clr = {
color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()),
effectValue: color.get_value()
};
} else {
clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b());
}
}
if (_.isObject(clr)) {
var isselected = false;
for (i = 0; i < 10; i++) {
if (Common.Utils.ThemeColor.ThemeValues[i] === clr.effectValue) {
this.statusbar.mnuTabColor.select(clr, true);
isselected = true;
break;
}
}
if (!isselected) {
this.statusbar.mnuTabColor.clearSelection();
}
} else {
this.statusbar.mnuTabColor.select(clr || "transparent", true);
}
}
}
i = -1;
while (++i < wc) {
++tabind;
ishidden = this.api.asc_isWorksheetHidden(i);
if (ishidden) {
--tabind;
}
if (!ishidden) {
this.setTabLineColor(this.statusbar.tabbar.getAt(tabind), this.api.asc_getWorksheetTabColor(i));
}
}
},
loadTabColor: function (sheetindex) {
if (this.api) {
if (!this.api.asc_isWorksheetHidden(sheetindex)) {
var tab = _.findWhere(this.statusbar.tabbar.tabs, {
sheetindex: sheetindex
});
if (tab) {
this.setTabLineColor(tab, this.api.asc_getWorksheetTabColor(sheetindex));
}
}
}
},
setTabLineColor: function (tab, color) {
if (tab) {
if (null !== color) {
color = "#" + Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b());
} else {
color = "";
}
if (color.length) {
if (!tab.isActive()) {
color = "0px 3px 0 " + Common.Utils.RGBColor(color).toRGBA(0.7) + " inset";
} else {
color = "0px 3px 0 " + color + " inset";
}
tab.$el.find("a").css("box-shadow", color);
} else {
tab.$el.find("a").css("box-shadow", "");
}
}
},
onZoomShow: function (e) {
if (e.target.classList.contains("disabled")) {
return false;
}
},
tipUsers: "Document is in the collaborative editing mode.",
tipMoreUsers: "and %1 users.",
tipShowUsers: "To see all users click the icon below.",
zoomText: "Zoom {0}%",
errorLastSheet: "Workbook must have at least one visible worksheet.",
errorRemoveSheet: "Can't delete the worksheet.",
warnDeleteSheet: "The worksheet maybe has data. Proceed operation?",
strSheet : "Sheet"
},
SSE.Controllers.Statusbar || {}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,109 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "common/main/lib/view/Header", "spreadsheeteditor/main/app/view/Viewport"], function (Viewport) {
SSE.Controllers.Viewport = Backbone.Controller.extend({
models: [],
collections: [],
views: ["Viewport", "Common.Views.Header"],
initialize: function () {
this.addListeners({
"Viewport": {}
});
},
setApi: function (api) {
this.api = api;
},
onLaunch: function () {
this.viewport = this.createView("Viewport").render();
this.header = this.createView("Common.Views.Header", {
headerCaption: "Spreadsheet Editor"
}).render();
Common.NotificationCenter.on("layout:changed", _.bind(this.onLayoutChanged, this));
$(window).on("resize", _.bind(this.onWindowResize, this));
this.viewport.celayout.on("layout:resizedrag", function () {
this.viewport.fireEvent("layout:resizedrag", [this, "cell:edit"]);
this.api.asc_Resize();
},
this);
this.viewport.hlayout.on("layout:resizedrag", function () {
this.api.asc_Resize();
},
this);
this.boxSdk = $("#editor_sdk");
this.boxFormula = $("#cell-editing-box");
this.boxSdk.css("border-left", "none");
this.boxFormula.css("border-left", "none");
},
onLayoutChanged: function (area) {
switch (area) {
default:
this.viewport.vlayout.doLayout();
this.viewport.celayout.doLayout();
case "rightmenu":
this.viewport.hlayout.doLayout();
break;
case "leftmenu":
var panel = this.viewport.hlayout.items[0];
if (panel.resize.el) {
if (panel.el.width() > 40) {
this.boxSdk.css("border-left", "");
this.boxFormula.css("border-left", "");
panel.resize.el.show();
} else {
panel.resize.el.hide();
this.boxSdk.css("border-left", "none");
this.boxFormula.css("border-left", "none");
}
}
this.viewport.hlayout.doLayout();
break;
case "header":
case "toolbar":
case "status":
this.viewport.vlayout.doLayout();
this.viewport.celayout.doLayout();
break;
case "celleditor":
if (arguments[1]) {
this.boxSdk.css("border-top", arguments[1] == "hidden" ? "none" : "");
}
this.viewport.celayout.doLayout();
break;
}
this.api.asc_Resize();
},
onWindowResize: function (e) {
this.onLayoutChanged("window");
Common.NotificationCenter.trigger("window:resize");
}
});
});

View File

@@ -1,46 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.model.FileTemplate", {
extend: "Ext.data.Model",
fields: [{
type: "string",
name: "name"
},
{
type: "string",
name: "icon"
},
{
type: "string",
name: "displayName"
}]
});

View File

@@ -1,43 +1,56 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.model.Formula", {
extend: "Ext.data.Model",
fields: [{
name: "group"
},
{
name: "func"
},
{
name: "args"
}]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone"], function (Backbone) {
SSE.Models = SSE.Models || {};
SSE.Models.FormulaModel = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
index: 0,
group: null,
name: null,
args: null
};
}
});
SSE.Models.FormulaGroup = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
index: 0,
name: null,
store: null,
functions: []
};
}
});
});

View File

@@ -1,46 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.model.RecentFile", {
extend: "Ext.data.Model",
fields: [{
type: "string",
name: "title"
},
{
type: "string",
name: "url"
},
{
type: "string",
name: "folder"
}]
});

View File

@@ -1,52 +1,53 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.model.ShapeModel", {
extend: "Ext.data.Model",
fields: [{
name: "imageUrl"
},
{
name: "data"
}]
});
Ext.define("SSE.model.ShapeGroup", {
extend: "Ext.data.Model",
fields: [{
name: "groupName"
},
{
name: "groupId"
},
{
name: "groupStore"
}]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone"], function (Backbone) {
SSE.Models = SSE.Models || {};
SSE.Models.ShapeModel = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
imageUrl: null,
data: null
};
}
});
SSE.Models.ShapeGroup = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
groupName: null,
groupId: null,
groupStore: null
};
}
});
});

View File

@@ -1,35 +1,45 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.model.TableTemplate", {
extend: "Ext.data.Model",
fields: ["type", "name", "imageUrl"]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone"], function (Backbone) {
SSE.Models = SSE.Models || {};
SSE.Models.TableTemplate = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
name: null,
caption: null,
type: null,
imageUrl: null
};
}
});
});

View File

@@ -1,133 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.plugin.TabBarScroller", {
alias: "plugin.tabbarscroller",
constructor: function (config) {
config = config || {};
Ext.apply(this, config);
},
init: function (tabBar) {
var me = this;
Ext.apply(tabBar, me.parentOverrides);
me.tabBar = tabBar;
tabBar.on({
render: function () {
me.layout = me.tabBar.layout;
if (me.lastButton) {
me.lastButton.on("click", me.scrollToLast, me);
}
if (me.firstButton) {
me.firstButton.on("click", me.scrollToFirst, me);
}
if (me.prevButton) {
me.beforeRepeater = Ext.create("Ext.util.ClickRepeater", me.prevButton.getEl(), {
interval: me.layout.overflowHandler.scrollRepeatInterval,
handler: me.layout.overflowHandler.scrollLeft,
scope: me.layout.overflowHandler
});
}
if (me.nextButton) {
me.afterRepeater = Ext.create("Ext.util.ClickRepeater", me.nextButton.getEl(), {
interval: me.layout.overflowHandler.scrollRepeatInterval,
handler: me.layout.overflowHandler.scrollRight,
scope: me.layout.overflowHandler
});
}
me.tabBar.addCls("asc-page-scroller");
me.layout.overflowHandler.updateScrollButtons = Ext.Function.createSequence(me.layout.overflowHandler.updateScrollButtons, me.updateButtons, me);
me.layout.overflowHandler.handleOverflow = Ext.Function.createSequence(me.layout.overflowHandler.handleOverflow, me.updateButtons, me);
me.layout.overflowHandler.clearOverflow = Ext.Function.createSequence(me.layout.overflowHandler.clearOverflow, me.disableButtons, me);
},
single: true
});
},
disableButtons: function () {
var me = this;
if (me.lastButton) {
me.lastButton.addClsWithUI("disabled");
me.lastButton.addCls("x-item-disabled");
me.lastButton.disabled = true;
}
if (me.firstButton) {
me.firstButton.addClsWithUI("disabled");
me.firstButton.addCls("x-item-disabled");
me.firstButton.disabled = true;
}
if (me.prevButton) {
me.prevButton.addClsWithUI("disabled");
me.prevButton.addCls("x-item-disabled");
me.prevButton.disabled = true;
}
if (me.nextButton) {
me.nextButton.addClsWithUI("disabled");
me.nextButton.addCls("x-item-disabled");
me.nextButton.disabled = true;
}
},
scrollToFirst: function (e) {
var me = this;
me.layout.overflowHandler.scrollTo(0);
},
scrollToLast: function (e) {
var me = this;
me.layout.overflowHandler.scrollTo(me.layout.overflowHandler.getMaxScrollPosition());
},
updateButtons: function () {
var me = this;
var beforeMethAll = me.layout.overflowHandler.atExtremeBefore() ? "addClsWithUI" : "removeClsWithUI",
afterMethAll = me.layout.overflowHandler.atExtremeAfter() ? "addClsWithUI" : "removeClsWithUI",
beforeMeth = me.layout.overflowHandler.atExtremeBefore() ? "addCls" : "removeCls",
afterMeth = me.layout.overflowHandler.atExtremeAfter() ? "addCls" : "removeCls",
beforeDisabled = (beforeMeth == "addCls"),
afterDisabled = (afterMeth == "addCls");
if (me.lastButton) {
me.lastButton[afterMethAll]("disabled");
me.lastButton[afterMeth]("x-item-disabled");
me.lastButton.disabled = afterDisabled;
}
if (me.nextButton) {
me.nextButton[afterMethAll]("disabled");
me.nextButton[afterMeth]("x-item-disabled");
me.nextButton.disabled = afterDisabled;
}
if (me.firstButton) {
me.firstButton[beforeMethAll]("disabled");
me.firstButton[beforeMeth]("x-item-disabled");
me.firstButton.disabled = beforeDisabled;
}
if (me.prevButton) {
me.prevButton[beforeMethAll]("disabled");
me.prevButton[beforeMeth]("x-item-disabled");
me.prevButton.disabled = beforeDisabled;
}
}
});

View File

@@ -1,52 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.plugin.TabReorderer", {
extend: "SSE.ux.BoxReorderer",
alias: "plugin.tabreorderer",
itemSelector: ".x-tab",
config: {
disabled: false
},
init: function (tabPanel) {
this.callParent(arguments);
},
clickValidator: function (e) {
return this.getDisabled() ? false : this.callParent(arguments);
},
afterBoxReflow: function () {
var me = this;
SSE.ux.BoxReorderer.prototype.afterBoxReflow.apply(me, arguments);
if (me.dragCmp) {
me.container.setActiveTab(me.dragCmp);
}
}
});

View File

@@ -1,35 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.store.FileTemplates", {
extend: "Ext.data.Store",
model: "SSE.model.FileTemplate"
});

View File

@@ -1,36 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.store.Formulas", {
extend: "Ext.data.Store",
model: "SSE.model.Formula",
sorters: ["func"]
});

View File

@@ -1,35 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.store.RecentFiles", {
extend: "Ext.data.Store",
model: "SSE.model.RecentFile"
});

View File

@@ -0,0 +1,10 @@
<div class="ce-group-name">
<input id="ce-cell-name" class="aslabel form-control" type="text">
<button id="ce-func-label" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon">&nbsp;</span></button>
</div>
<div class="ce-group-expand">
<button id="ce-btn-expand" type="button" class="btn"><span class="caret">&nbsp;</span></button>
</div>
<div class="ce-group-content">
<textarea id="ce-cell-content" class="form-control" spellcheck="false" rows="1" cols="20"></textarea>
</div>

View File

@@ -0,0 +1,51 @@
<table cols="3">
<tr>
<td colspan=3>
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="88px">
<label class="input-label"><%= scope.textWidth %></label>
<div id="chart-spin-width"></div>
</td>
<td class="padding-small" width="28px" style="vertical-align: bottom;">
<div id="chart-button-ratio"></div>
</td>
<td class="padding-small" width="88px">
<label class="input-label"><%= scope.textHeight %></label>
<div id="chart-spin-height"></div>
</td>
</tr>
</table>
<table cols="2">
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textChartType %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="chart-button-type" style=""></div>
</td>
<td class="padding-small">
<div id="chart-button-style" style=""></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="chart-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,299 @@
<div id="id-chart-settings-dlg-style" class="settings-panel active">
<div class="inner-content">
<table cols="2" style="">
<tr>
<td class="padding-large">
<label class="header"><%= scope.textType %></label>
<div id="chart-dlg-button-type" style="margin-right: 15px;"></div>
</td>
<td class="padding-large">
<label class="header"><%= scope.textStyle %></label>
<div id="chart-dlg-button-style" style=""></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 >
<label class="header"><%= scope.textDataRange %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="200">
<div id="chart-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div>
</td>
<td class="padding-small" style="text-align: right;">
<button type="button" class="btn btn-text-default" id="chart-dlg-btn-data" style="min-width: 100px;"><%= scope.textSelectData %></button>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="input-label"><%= scope.textDataSeries %></label>
<div id="chart-dlg-combo-range" class="input-group-nr" style="width:120px;"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-chart-settings-dlg-layout" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textChartTitle %></label>
<div id="chart-dlg-combo-chart-title" class="input-group-nr"></div>
</td>
<td class="padding-small">
<label class="input-label" style="margin-left: 15px;"><%= scope.textLegendPos %></label>
<div id="chart-dlg-combo-legend-pos" class="input-group-nr" style="margin-left: 15px;" />
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textHorTitle %></label>
<div id="chart-dlg-combo-hor-title" class="input-group-nr"></div>
</td>
<td class="padding-small">
<label class="input-label" style="margin-left: 15px;"><%= scope.textVertTitle %></label>
<div id="chart-dlg-combo-vert-title" class="input-group-nr" style="margin-left: 15px;" />
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textHorGrid %></label>
<div id="chart-dlg-combo-hor-grid" class="input-group-nr"></div>
</td>
<td class="padding-small">
<label class="input-label" style="margin-left: 15px;"><%= scope.textVertGrid %></label>
<div id="chart-dlg-combo-vert-grid" class="input-group-nr" style="margin-left: 15px;" />
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textDataLabels %></label>
<div id="chart-dlg-combo-data-labels" class="input-group-nr"></div>
</td>
<td rowspan="2" class="padding-small">
<div id="chart-dlg-check-series" style="margin: 20px 0 9px 15px;"></div>
<div id="chart-dlg-check-category" style="margin: 0 0 9px 15px;"></div>
<div id="chart-dlg-check-value" style="margin: 0 0 5px 15px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textSeparator %></label>
<div id="chart-dlg-txt-separator" class="input-row" />
</td>
</tr>
<tr>
<td class="padding-small">
<label id="chart-dlg-label-lines" class="input-label"><%= scope.textLines %></label>
<div id="chart-dlg-combo-lines" class="input-group-nr"></div>
</td>
<td class="padding-small" style="vertical-align: bottom;">
<div id="chart-dlg-check-markers" style="margin: 0 0 4px 15px;"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-chart-settings-dlg-vert" class="settings-panel">
<div class="inner-content">
<table cols="3" style="width: 100%">
<tr>
<td colspan="3">
<label class="header padding-small"><%= scope.textAxisOptions %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="100">
<label class="input-label"><%= scope.textMinValue %></label>
</td>
<td class="padding-small" width="115" style="padding-right: 10px;">
<div id="chart-dlg-combo-mintype"></div>
</td>
<td class="padding-small" width="90">
<div id="chart-dlg-input-min-value"></div>
</td>
</tr>
<tr>
<td class="padding-large" width="100">
<label class="input-label"><%= scope.textMaxValue %></label>
</td>
<td class="padding-large" width="115" style="padding-right: 10px;">
<div id="chart-dlg-combo-maxtype"></div>
</td>
<td class="padding-large" width="90">
<div id="chart-dlg-input-max-value"></div>
</td>
</tr>
<tr>
<td class="padding-large" width="100">
<label class="input-label"><%= scope.textAxisCrosses %></label>
</td>
<td class="padding-large" width="115" style="padding-right: 10px;">
<div id="chart-dlg-combo-v-crosstype"></div>
</td>
<td class="padding-large" width="90">
<div id="chart-dlg-input-v-axis-crosses"></div>
</td>
</tr>
</table>
</div>
<div class="inner-content">
<table cols="1" style="width: 100%;">
<tr>
<td class="padding-large">
<label class="input-label"><%= scope.textUnits %></label>
<div id="chart-dlg-combo-units" class="input-group-nr" style="width:140px;"></div>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="chart-dlg-check-v-reverse"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textTickOptions %></label>
</td>
</tr>
<tr>
<td class="padding-large">
<label class="input-label"><%= scope.textMajorType %></label>
<div id="chart-dlg-combo-v-major-type" class="input-group-nr"></div>
</td>
<td class="padding-large">
<label class="input-label" style="margin-left: 15px;"><%= scope.textMinorType %></label>
<div id="chart-dlg-combo-v-minor-type" class="input-group-nr" style="margin-left: 15px;" />
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="1" style="width: 100%;">
<tr>
<td class="padding-small">
<label class="header"><%= scope.textLabelOptions %></label>
</td>
</tr>
<tr>
<td>
<label class="input-label"><%= scope.textLabelPos %></label>
<div id="chart-dlg-combo-v-label-pos" class="input-group-nr" style="width:140px;"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-chart-settings-dlg-hor" class="settings-panel">
<div class="inner-content">
<table cols="3" style="width: 100%">
<tr>
<td colspan="3">
<label class="header padding-small"><%= scope.textAxisOptions %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="100">
<label class="input-label"><%= scope.textAxisCrosses %></label>
</td>
<td class="padding-small" width="115" style="padding-right: 10px;">
<div id="chart-dlg-combo-h-crosstype"></div>
</td>
<td class="padding-small" width="90">
<div id="chart-dlg-input-h-axis-crosses"></div>
</td>
</tr>
</table>
</div>
<div class="inner-content">
<table cols="1" style="width: 100%;">
<tr>
<td class="padding-large" width="140">
<label class="input-label"><%= scope.textAxisPos %></label>
<div id="chart-dlg-combo-axis-pos" class="input-group-nr" style="width:140px;"></div>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="chart-dlg-check-h-reverse"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textTickOptions %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="140">
<label class="input-label"><%= scope.textMajorType %></label>
<div id="chart-dlg-combo-h-major-type" class="input-group-nr"></div>
</td>
<td class="padding-small">
<label class="input-label" style="margin-left: 15px;"><%= scope.textMinorType %></label>
<div id="chart-dlg-combo-h-minor-type" class="input-group-nr" style="margin-left: 15px;"></div>
</td>
</tr>
<tr>
<td width="100%" colspan="2">
<label class="input-label"><%= scope.textMarksInterval %></label>
</td>
</tr>
<tr>
<td class="padding-large" width="140">
<div id="chart-dlg-input-marks-interval"></div>
</td>
<td class="padding-large">
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textLabelOptions %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="140">
<label class="input-label"><%= scope.textLabelPos %></label>
<div id="chart-dlg-combo-h-label-pos" class="input-group-nr"></div>
</td>
<td class="padding-small">
<label class="input-label" style="margin-left: 15px;"><%= scope.textLabelDist %></label>
<div id="chart-dlg-input-label-dist" style="margin-left: 15px;"></div>
</td>
</tr>
<tr>
<td width="100%" colspan="2">
<label class="input-label"><%= scope.textLabelInterval %></label>
</td>
</tr>
<tr>
<td width="140">
<div id="chart-dlg-combo-label-int" class="input-group-nr"></div>
</td>
<td style="vertical-align: bottom;">
<div id="chart-dlg-input-label-int" style="margin-left: 15px;"></div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,28 @@
<div class="panel-menu">
<li class="fm-first-item"/>
<li id="fm-btn-return" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-save" class="fm-btn" />
<li id="fm-btn-edit" class="fm-btn" />
<li id="fm-btn-download" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-info" class="fm-btn" />
<li class="devider" class="fm-btn" />
<li id="fm-btn-settings" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-help" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-back" class="fm-btn" />
</div>
<div class="panel-context">
<div id="panel-saveas" class="content-box" />
<div id="panel-recentfiles" class="content-box" />
<div id="panel-createnew" class="content-box" />
<div id="panel-info" class="content-box" />
<div id="panel-settings" class="content-box" />
<div id="panel-help" class="content-box" />
</div>

View File

@@ -0,0 +1,46 @@
<table cols="3">
<tr>
<td colspan=3>
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="88px">
<label class="input-label"><%= scope.textWidth %></label>
<div id="image-spin-width"></div>
</td>
<td class="padding-small" width="28px" style="vertical-align: bottom;">
<div id="image-button-ratio"></div>
</td>
<td class="padding-small" width="88px">
<label class="input-label"><%= scope.textHeight %></label>
<div id="image-spin-height"></div>
</td>
</tr>
</table>
<table cols="2">
<tr>
<td class="padding-small" colspan=2>
<button type="button" class="btn btn-text-default" id="image-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textInsert %></label>
</td>
</tr>
<tr>
<td width="50%">
<button type="button" class="btn btn-text-default" id="image-button-from-file" style="width:85px;"><%= scope.textFromFile %></button>
</td>
<td width="50%">
<button type="button" class="btn btn-text-default" id="image-button-from-url" style="width:85px;"><%= scope.textFromUrl %></button>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,18 @@
<div id="view-left-menu" class="tool-menu left">
<div class="tool-menu-btns">
<button id="left-btn-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon btn-menu-file">&nbsp;</span></button>
<button id="left-btn-search" class="btn btn-category" content-target=""><span class="btn-icon btn-menu-search">&nbsp;</span></button>
<!-- /** coauthoring begin **/ -->
<button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><span class="btn-icon btn-menu-comments">&nbsp;</span></button>
<button id="left-btn-chat" class="btn btn-category" content-target="left-panel-chat"><span class="btn-icon btn-menu-chat">&nbsp;</span></button>
<!-- /** coauthoring end **/ -->
<button id="left-btn-support" class="btn btn-category" content-target=""><span class="btn-icon btn-menu-support">&nbsp;</span></button>
<button id="left-btn-about" class="btn btn-category" content-target=""><span class="btn-icon btn-menu-about">&nbsp;</span></button>
</div>
<div class="left-panel" style="">
<!-- /** coauthoring begin **/ -->
<div id="left-panel-comments" class="" style="display: none;" />
<div id="left-panel-chat" class="" style="display: none;" />
<!-- /** coauthoring end **/ -->
</div>
</div>

View File

@@ -0,0 +1,38 @@
<table cols="2">
<tr>
<td colspan=2>
<label class="header"><%= scope.strParagraphSpacing %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textAt %></label>
<div id="paragraph-combo-line-rule" style="width: 85px;"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textAt %></label>
<div id="paragraph-spin-line-height"></div>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.strSpacingBefore %></label>
<div id="paragraph-spin-spacing-before"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.strSpacingAfter %></label>
<div id="paragraph-spin-spacing-after"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="paragraph-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,98 @@
<div id="id-adv-paragraph-indents" class="settings-panel active">
<div class="inner-content">
<table cols="3" style="width: 100%;">
<tr>
<td class="padding-large">
<label class="input-label"><%= scope.strIndentsFirstLine %></label>
<div id="paragraphadv-spin-first-line" style="width: 85px;"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.strIndentsLeftText %></label>
<div id="paragraphadv-spin-indent-left"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.strIndentsRightText %></label>
<div id="paragraphadv-spin-indent-right"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-paragraph-font" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textEffects %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="paragraphadv-checkbox-strike"></div>
</td>
<td class="padding-small">
<div id="paragraphadv-checkbox-subscript"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="paragraphadv-checkbox-double-strike"></div>
</td>
<td class="padding-small">
<div id="paragraphadv-checkbox-small-caps"></div>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="paragraphadv-checkbox-superscript"></div>
</td>
<td class="padding-large">
<div id="paragraphadv-checkbox-all-caps"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textCharacterSpacing %></label>
</td>
</tr>
<tr>
<td colspan=2 class="padding-large" width="50%">
<div id="paragraphadv-spin-spacing"></div>
</td>
</tr>
<tr>
<td colspan=2>
<div style="border: 1px solid #cbcbcb;">
<div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>
</div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-paragraph-tabs" class="settings-panel">
<div class="inner-content">
<div class="padding-small" style="display: inline-block;">
<label class="input-label"><%= scope.textTabPosition %></label>
<div id="paraadv-spin-tab"></div>
</div>
<div class="padding-small" style="display: inline-block; float: right;">
<label class="input-label"><%= scope.textDefault %></label>
<div id="paraadv-spin-default-tab"></div>
</div>
<div class="padding-large">
<div id="paraadv-list-tabs" style="width:180px; height: 90px;"></div>
</div>
<div class="padding-large" >
<label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>
<div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-right" style="display: block;"></div>
</div>
<div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button>
</div>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<div class="settings-panel active">
<div class="padding-large inner-content" >
<div id="printadv-dlg-radio-current" class="padding-small" style="display: block;"></div>
<div id="printadv-dlg-radio-all" class="padding-small" style="display: block;"></div>
<div id="printadv-dlg-radio-selection" style="display: block;"></div>
</div>
<div class="separator horizontal padding-large"/>
<div class="padding-large inner-content" >
<div id="printadv-dlg-combo-pages" class="input-group-nr" />
</div>
<div class="separator horizontal padding-large"/>
<div class="padding-large inner-content" >
<span id="printadv-dlg-combo-orient" />
</div>
<div id="printadv-dlg-content-to-hide">
<div class="separator horizontal padding-large"/>
<div class="padding-large inner-content" >
<table cols="2" class="no-padding">
<tr>
<td><label><%= scope.strTop %></label></td>
<td><label><%= scope.strBottom %></label></td>
</tr>
<tr>
<td class="padding-small"><div id="printadv-dlg-spin-margin-top" style="margin-right: 15px;"></div></td>
<td class="padding-small"><div id="printadv-dlg-spin-margin-bottom"></div></td>
</tr>
<tr>
<td><label><%= scope.strLeft %></label></td>
<td><label><%= scope.strRight %></label></td>
</tr>
<tr>
<td><div id="printadv-dlg-spin-margin-left" style="margin-right: 15px;"></div></td>
<td><div id="printadv-dlg-spin-margin-right"></div></td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"/>
<!--<div class="padding-large inner-content" >-->
<!--<div id="printadv-dlg-radio-actual" class="padding-small" style="display: block;"></div>-->
<!--<div id="printadv-dlg-radio-fit" class="" style="display: block;"></div>-->
<!--</div>-->
<!--<div class="separator horizontal padding-large"/>-->
<div class="inner-content">
<div id="printadv-dlg-chb-grid" style="margin-bottom: 10px;"/>
<div id="printadv-dlg-chb-rows"/>
</div>
</div>
</div>

View File

@@ -0,0 +1,23 @@
<div id="view-right-menu" class="tool-menu right">
<div class="right-panel">
<div id="id-shape-settings" class="settings-panel">
</div>
<div id="id-image-settings" class="settings-panel">
</div>
<!-- /** proprietary begin **/ -->
<div id="id-chart-settings" class="settings-panel">
</div>
<!-- /** proprietary end **/ -->
<div id="id-paragraph-settings" class="settings-panel">
</div>
</div>
<div class="tool-menu-btns">
<div class="ct-btn-category arrow-left" />
<button id="id-right-menu-shape" class="btn btn-category arrow-left" content-target="id-shape-settings"><span class="btn-icon btn-menu-shape">&nbsp;</span></button>
<button id="id-right-menu-image" class="btn btn-category arrow-left" content-target="id-image-settings"><span class="btn-icon btn-menu-image">&nbsp;</span></button>
<!-- /** proprietary begin **/ -->
<button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><span class="btn-icon btn-menu-chart">&nbsp;</span></button>
<!-- /** proprietary end **/ -->
<button id="id-right-menu-text" class="btn btn-category arrow-left" content-target="id-paragraph-settings"><span class="btn-icon btn-menu-text">&nbsp;</span></button>
</div>
</div>

View File

@@ -0,0 +1,136 @@
<table cols="1">
<tr>
<td>
<label class="header"><%= scope.strFill %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="shape-combo-fill-src" style="width: 100%;"></div>
</td>
</tr>
<tr>
<td>
<div id="shape-panel-color-fill" class="padding-small" style="width: 100%;">
<div id="shape-back-color-btn" style=""></div>
</div>
<div id="shape-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="50%">
<button type="button" class="btn btn-text-default" id="shape-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>
</td>
<td class="padding-small" width="50%">
<button type="button" class="btn btn-text-default" id="shape-button-from-url" style="width:90px;"><%= scope.textFromUrl %></button>
</td>
</tr>
<tr>
<td style="vertical-align: top">
<div id="shape-combo-fill-type" style="width: 90px;"></div>
</td>
<td rowspan="2">
<div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;">
<div id="shape-texture-img" style="width: 50px;height: 50px;"></div>
</div>
</td>
</tr>
<tr>
<td style="vertical-align: bottom">
<label class="input-label" style=""><%= scope.textTexture %></label>
<div id="shape-combo-fill-texture" style="width: 90px;"></div>
</td>
</tr>
</table>
</div>
<div id="shape-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">
<label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>
<div id="shape-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>
<div style="width: 100%; height: 25px; margin-bottom: 8px;">
<label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>
<div id="shape-foreground-color-btn" style="display: inline-block; float:right;"></div>
</div>
<div style="width: 100%; height: 25px;">
<label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>
<div id="shape-background-color-btn" style="display: inline-block; float:right;"></div>
</div>
</div>
<div id="shape-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">
<div style="height:80px;">
<div style="display: inline-block;">
<label class="input-label" style=""><%= scope.textStyle %></label>
<div id="shape-combo-grad-type" style="width: 90px;"></div>
</div>
<div style="display: inline-block;float: right;">
<label class="input-label" style=""><%= scope.textDirection %></label>
<div id="shape-button-direction" style=""></div>
</div>
</div>
<label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>
<div style="display: inline-block; margin-top: 3px;">
<div id="shape-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>
</div>
<div id="shape-gradient-color-btn" style="display: inline-block;float: right;"></div>
</div>
</td>
</tr>
<tr>
<td>
<div class="padding-small" id="shape-panel-transparent-fill" style="width: 100%;">
<label class="header" style="display:block;"><%= scope.strTransparency %></label>
<div style="display: inline-block; margin-top: 3px;">
<label id="shape-lbl-transparency-start">0</label>
<div id="shape-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>
<label id="shape-lbl-transparency-end">100</label>
</div>
<div id="shape-spin-transparency" style="display: inline-block;float: right;"></div>
</div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td>
<label class="header"><%= scope.strStroke %></label>
</td>
</tr>
<tr>
<td>
<div style="display:inline-block;width:100px;vertical-align: middle;">
<label class="input-label" style=""><%= scope.strSize %></label>
<div id="shape-combo-border-size" style="width: 93px;"></div>
</div>
<div style="display:inline-block;vertical-align: middle;">
<label class="input-label" style=""><%= scope.strColor %></label>
<div id="shape-border-color-btn" style=""></div>
</div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small"></td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<label class="header" style="margin-top: 3px;"><%= scope.strChange %></label>
<div id="shape-btn-change" style="display: inline-block; float:right;"></div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="shape-only">
<td align="center">
<label class="link" id="shape-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,96 @@
<div id="id-adv-shape-width" class="settings-panel active">
<div class="inner-content">
<table cols="3">
<tr>
<td width="108px">
<label class="input-label"><%= scope.textWidth %></label>
<div id="shape-advanced-spin-width"></div>
</td>
<td width="28px" style="vertical-align: bottom;">
<div id="shape-advanced-button-ratio"></div>
</td>
<td width="108px">
<label class="input-label"><%= scope.textHeight %></label>
<div id="shape-advanced-spin-height"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-shape-shape" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textLineStyle %></label>
</td>
</tr>
<tr>
<td class="padding-large" width="125px">
<label class="input-label"><%= scope.textCapType %></label>
<div id="shape-advanced-cap-type" style="width: 100px;"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textJoinType %></label>
<div id="shape-advanced-join-type" style="width: 100px;"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textArrows %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textBeginStyle %></label>
<div id="shape-advanced-begin-style" style="width: 100px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textEndStyle %></label>
<div id="shape-advanced-end-style" style="width: 100px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBeginSize %></label>
<div id="shape-advanced-begin-size" style="width: 100px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textEndSize %></label>
<div id="shape-advanced-end-size" style="width: 100px;"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-shape-margins" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textTop %></label>
<div id="shape-margin-top"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textLeft %></label>
<div id="shape-margin-left"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBottom %></label>
<div id="shape-margin-bottom"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRight %></label>
<div id="shape-margin-right"></div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,41 @@
<div class="statusbar">
<div id="status-tabs-scroll" class="status-group">
<button id="status-btn-tabfirst" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon btn-tab-first">&nbsp;</span></button>
<button id="status-btn-tabback" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon btn-tab-back">&nbsp;</span></button>
<button id="status-btn-tabnext" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon btn-tab-next">&nbsp;</span></button>
<button id="status-btn-tablast" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon btn-tab-last">&nbsp;</span></button>
</div>
<div id="status-addtabs-box" class="status-group">
<button id="status-btn-addtab" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon btn-zoom-up">&nbsp;</span></button>
</div>
<div id="status-zoom-box" class="status-group">
<div class="separator short" />
<button id="status-btn-zoomdown" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon btn-zoom-down">&nbsp;</span></button>
<div class="cnt-zoom">
<div class="dropdown-toggle" data-toggle="dropdown">
<label id="status-label-zoom" class="status-label">Zoom 100%</label>
</div>
</div>
<button id="status-btn-zoomup" type="button" class="btn small btn-toolbar btn-toolbar-default" style="margin-right:40px;"><span class="btn-icon btn-zoom-up">&nbsp;</span></button>
</div>
<!-- /** coauthoring begin **/ -->
<div id="status-users-box" class="status-group" style="display:none;">
<div class="separator short" />
<div id="status-users-block" style="display:inline-block; cursor:pointer; margin-left: 12px;">
<span id="status-users-icon" />
<label id="status-users-count" class="status-label">3</label>
</div>
</div>
<!-- /** coauthoring end **/ -->
<div id="status-math-box" class="status-group">
<div class="separator short" style="margin-right: 12px;" />
<label id="status-math-average" class="status-label">AVERAGE: 10</label>
<label id="status-math-count" class="status-label">COUNT: 3</label>
<label id="status-math-sum" class="status-label">SUM: 5</label>
</div>
<div id="status-sheets-bar-box">
<div id="status-sheets-bar" class="status-group">
</div>
</div>
</div>

View File

@@ -0,0 +1,255 @@
<div class="toolbar" style="<%= (isCompactView || isEditDiagram) ? 'height: 41px;' : 'height: 67px;' %>">
<!----------------------->
<!-- Edit diagram mode -->
<!----------------------->
<div id="id-toolbar-diagramm" style="<%= isEditDiagram ? 'display: table;' : 'display: none;' %> width: 100%;" >
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-copy"></span>
<span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-paste"></span>
<span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-diagram-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-formula"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-digit-dec"></span>
<span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-digit-inc"></span>
<span class="btn-placeholder border" id="id-toolbar-diagram-placeholder-btn-format" style="width: 84px; margin-left: 10px;"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder border" id="id-toolbar-diagram-placeholder-btn-chart" style="width: auto;"></span>
</div>
</div>
<div class="toolbar-group" style="width: 100%;"></div>
</div>
<!------------------------>
<!-- Short view toolbar -->
<!------------------------>
<div id="id-toolbar-short" style="<%= (!isCompactView || isEditDiagram) ? 'display: none;' : 'display: table;' %> width: 100%;" >
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-print"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-save"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row" style="width: 140px; margin-top: -1px;">
<span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-short-placeholder-field-fontname"></span>
<span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-short-placeholder-field-fontsize"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-bold"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-italic"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-underline"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fontcolor"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fillparag"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-borders"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-halign"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-valign"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-merge"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-wrap"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertimage"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertchart"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertshape"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-formula"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-filter"></span>
<span class="btn-placeholder border" id="id-toolbar-short-placeholder-btn-format" style="width: 84px; margin-left: 7px;"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-copystyle"></span>
</div>
</div>
<!--<div class="separator short"></div>-->
<!--<div class="toolbar-group">-->
<!--<div class="toolbar-row">-->
<!--<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-cell-ins"></span>-->
<!--<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-cell-del"></span>-->
<!--</div>-->
<!--</div>-->
<div class="toolbar-group" style="width: 100%;"></div>
<div class="toolbar-group no-mask" style="padding-left:0;">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidebars"></span>
</div>
</div>
</div>
<!------------------------>
<!-- Fully view toolbar -->
<!------------------------>
<div id="id-toolbar-full" style="<%= (isCompactView || isEditDiagram)? 'display: none;' : 'display: table;' %> width: 100%;" >
<div class="toolbar-group toolbar-group-native">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-newdocument"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-opendocument"></span>
</div>
</div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-print"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-save"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-copy"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-paste"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-full-placeholder-field-fontname"></span>
<span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-full-placeholder-field-fontsize"></span>
<span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-incfont" style="margin-left: 2px;"></span>
<span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-decfont" style="margin-left: 2px;"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bold"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-italic"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-underline"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fontcolor"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fillparag"></span>
<div class="separator short" style="margin: 0 6px;"></div>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-borders"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-top"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-middle"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bottom"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-wrap"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-text-orient"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-left"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-center"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-right"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-just"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-merge"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertimage"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertchart"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-text"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-formula"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder " id="id-toolbar-full-placeholder-btn-insertshape"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-sortdesc"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-sortasc"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-setfilter"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clear-filter"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-format" style="width: 100%;"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-percents"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-currency"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-digit-dec"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-digit-inc"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-cell-ins"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-cell-del"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clear"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-copystyle"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-colorschemas"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-table-tpl"></span>
</div>
</div>
<div class="toolbar-group" id="id-toolbar-full-placeholder-field-styles" style="width: 100%; min-width: 100px;">
</div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidebars"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-settings"></span>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,21 @@
<div class="layout-region">
<div id="viewport-vbox-layout" class="layout-ct vbox">
<div id="header" class="layout-item"></div>
<div id="toolbar" class="layout-item"></div>
<div class="layout-item">
<div id="viewport-hbox-layout" class="layout-ct hbox">
<div id="left-menu" class="layout-item" style="width: 40px;"></div>
<div id="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div class="layout-item">
<div class="layout-ct vbox">
<div id="cell-editing-box" class="layout-item" style="height:18px;"></div>
<div id="editor_sdk" class="layout-item" style="min-height: 100px;"></div>
</div>
</div>
<div id="right-menu" class="layout-item"></div>
</div>
</div>
<div id="statusbar" class="layout-item"></div>
</div>
</div>

View File

@@ -1,234 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.ux.BoxReorderer", {
mixins: {
observable: "Ext.util.Observable"
},
itemSelector: ".x-box-item",
animate: 100,
constructor: function () {
this.addEvents("startdrag", "drag", "changeindex", "drop");
this.mixins.observable.constructor.apply(this, arguments);
},
init: function (container) {
this.container = container;
this.container.afterLayout = Ext.Function.createSequence(this.container.afterLayout, this.afterFirstLayout, this);
container.destroy = Ext.Function.createSequence(container.destroy, this.onContainerDestroy, this);
},
onContainerDestroy: function () {
if (this.dd) {
this.dd.unreg();
}
},
afterFirstLayout: function () {
var me = this,
l = me.container.getLayout();
delete me.container.afterLayout;
me.dd = Ext.create("Ext.dd.DD", l.innerCt, me.container.id + "-reorderer");
Ext.apply(me.dd, {
animate: me.animate,
reorderer: me,
container: me.container,
getDragCmp: this.getDragCmp,
clickValidator: Ext.Function.createInterceptor(me.dd.clickValidator, me.clickValidator, me, false),
onMouseDown: me.onMouseDown,
startDrag: me.startDrag,
onDrag: me.onDrag,
endDrag: me.endDrag,
getNewIndex: me.getNewIndex,
doSwap: me.doSwap,
findReorderable: me.findReorderable
});
me.dd.dim = l.parallelPrefix;
me.dd.startAttr = l.parallelBefore;
me.dd.endAttr = l.parallelAfter;
},
getDragCmp: function (e) {
return this.container.getChildByElement(e.getTarget(this.itemSelector, 10));
},
clickValidator: function (e) {
var cmp = this.getDragCmp(e);
return !! (cmp && cmp.reorderable !== false);
},
onMouseDown: function (e) {
var me = this,
container = me.container,
containerBox, cmpEl, cmpBox;
me.dragCmp = me.getDragCmp(e);
if (me.dragCmp) {
cmpEl = me.dragCmp.getEl();
me.startIndex = me.curIndex = container.items.indexOf(me.dragCmp);
cmpBox = cmpEl.getPageBox();
me.lastPos = cmpBox[this.startAttr];
containerBox = container.el.getPageBox();
if (me.dim === "width") {
me.minX = containerBox.left;
me.maxX = containerBox.right - cmpBox.width;
me.minY = me.maxY = cmpBox.top;
me.deltaX = e.getPageX() - cmpBox.left;
} else {
me.minY = containerBox.top;
me.maxY = containerBox.bottom - cmpBox.height;
me.minX = me.maxX = cmpBox.left;
me.deltaY = e.getPageY() - cmpBox.top;
}
me.constrainY = me.constrainX = true;
}
},
startDrag: function () {
var me = this;
if (me.dragCmp) {
me.dragCmp.setPosition = Ext.emptyFn;
if (!me.container.layout.animate && me.animate) {
me.container.layout.animate = me.animate;
me.removeAnimate = true;
}
me.dragElId = me.dragCmp.getEl().id;
me.reorderer.fireEvent("StartDrag", me, me.container, me.dragCmp, me.curIndex);
me.dragCmp.suspendEvents();
me.dragCmp.disabled = true;
me.dragCmp.el.setStyle("zIndex", 100);
} else {
me.dragElId = null;
}
},
findReorderable: function (newIndex) {
var me = this,
items = me.container.items,
newItem;
if (items.getAt(newIndex).reorderable === false) {
newItem = items.getAt(newIndex);
if (newIndex > me.startIndex) {
while (newItem && newItem.reorderable === false) {
newIndex++;
newItem = items.getAt(newIndex);
}
} else {
while (newItem && newItem.reorderable === false) {
newIndex--;
newItem = items.getAt(newIndex);
}
}
}
newIndex = Math.min(Math.max(newIndex, 0), items.getCount() - 1);
if (items.getAt(newIndex).reorderable === false) {
return -1;
}
return newIndex;
},
doSwap: function (newIndex) {
var me = this,
items = me.container.items,
orig, dest, tmpIndex;
newIndex = me.findReorderable(newIndex);
if (newIndex === -1) {
return;
}
me.reorderer.fireEvent("ChangeIndex", me, me.container, me.dragCmp, me.startIndex, newIndex);
orig = items.getAt(me.curIndex);
dest = items.getAt(newIndex);
items.remove(orig);
tmpIndex = Math.min(Math.max(newIndex, 0), items.getCount() - 1);
items.insert(tmpIndex, orig);
items.remove(dest);
items.insert(me.curIndex, dest);
me.container.layout.layout();
me.curIndex = newIndex;
},
onDrag: function (e) {
var me = this,
newIndex;
newIndex = me.getNewIndex(e.getPoint());
if ((newIndex !== undefined)) {
me.reorderer.fireEvent("Drag", me, me.container, me.dragCmp, me.startIndex, me.curIndex);
me.doSwap(newIndex);
}
},
endDrag: function (e) {
e.stopEvent();
var me = this;
if (me.dragCmp) {
delete me.dragElId;
if (me.animate) {
me.container.layout.animate = {
callback: Ext.Function.bind(me.reorderer.afterBoxReflow, me)
};
}
delete me.dragCmp.setPosition;
me.container.layout.layout();
if (me.removeAnimate) {
delete me.removeAnimate;
delete me.container.layout.animate;
} else {
me.reorderer.afterBoxReflow.call(me);
}
me.reorderer.fireEvent("drop", me, me.container, me.dragCmp, me.startIndex, me.curIndex);
}
},
afterBoxReflow: function () {
var me = this;
me.dragCmp.el.setStyle("zIndex", "");
me.dragCmp.disabled = false;
me.dragCmp.resumeEvents();
},
getNewIndex: function (pointerPos) {
var me = this,
dragEl = me.getDragEl(),
dragBox = Ext.fly(dragEl).getPageBox(),
targetEl,
targetBox,
targetMidpoint,
i = 0,
it = me.container.items.items,
ln = it.length,
lastPos = me.lastPos;
me.lastPos = dragBox[me.startAttr];
for (; i < ln; i++) {
targetEl = it[i].getEl();
if (targetEl.is(me.reorderer.itemSelector)) {
targetBox = targetEl.getPageBox();
targetMidpoint = targetBox[me.startAttr] + (targetBox[me.dim] >> 1);
if (i < me.curIndex) {
if ((dragBox[me.startAttr] < lastPos) && (dragBox[me.startAttr] < (targetMidpoint - 5))) {
return i;
}
} else {
if (i > me.curIndex) {
if ((dragBox[me.startAttr] > lastPos) && (dragBox[me.endAttr] > (targetMidpoint + 5))) {
return i;
}
}
}
}
}
}
});

View File

@@ -1,331 +1,643 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.AutoFilterDialog", {
extend: "Ext.window.Window",
alias: "widget.sseautofilterdialog",
requires: ["Ext.window.Window", "Common.plugin.GridScrollPane", "Common.component.SearchField"],
modal: true,
closable: true,
resizable: false,
height: 350,
width: 270,
constrain: true,
padding: "20px 20px 0 20px",
layout: {
type: "vbox",
align: "stretch"
},
initComponent: function () {
var me = this;
this.addEvents("onmodalresult");
this.btnSortDesc = Ext.create("Ext.Button", {
iconCls: "asc-toolbar-btn btn-sort-up",
width: 28,
enableToggle: true,
toggleGroup: "autoFilterSort",
allowDepress: false,
listeners: {
click: function () {
me.fireEvent("onmodalresult", me, 3, "descending");
me.close();
}
}
});
this.btnSortAsc = Ext.create("Ext.Button", {
iconCls: "asc-toolbar-btn btn-sort-down",
width: 28,
enableToggle: true,
style: "margin: 0 6px 0 0",
toggleGroup: "autoFilterSort",
allowDepress: false,
listeners: {
click: function () {
me.fireEvent("onmodalresult", me, 3, "ascending");
me.close();
}
}
});
this.chCustomFilter = Ext.widget("checkbox", {
style: "margin: 0 6px 0 0",
disabled: true,
boxLabel: ""
});
var btnCustomFilter = Ext.create("Ext.Button", {
width: 120,
text: me.btnCustomFilter,
listeners: {
click: function () {
me.fireEvent("onmodalresult", me, 2);
me.close();
}
}
});
var range, full_range;
var txtSearch = Ext.create("Common.component.SearchField", {
style: "margin: 10px 0",
emptyText: me.txtEmpty,
listeners: {
change: function (obj, newval, oldval, opts) {
me.cellsStore.clearFilter(true);
if (oldval && newval.length < oldval.length) {
selectionModel.selected.clear();
full_range = me.cellsStore.getAt(0).ischecked;
range = me.cellsStore.getRange(full_range ? 0 : 1);
range.forEach(function (record) {
(full_range || record.ischecked) && selectionModel.selected.add(record);
});
}
if (newval.length) {
me.cellsStore.filter([{
property: "cellvalue",
value: new RegExp(newval, "i")
},
{
property: "rowvisible",
value: /^((?!ever|hidden).)*$/
}]);
} else {
me.cellsStore.filter("rowvisible", /^((?!hidden).)*$/);
}
},
searchstart: function (obj, text) {
me.cellsStore.filter([{
property: "cellvalue",
value: new RegExp(text, "i")
},
{
property: "rowvisible",
value: /^((?!ever|hidden).)*$/
}]);
this.stopSearch(true);
},
searchclear: function () {}
}
});
this.cellsStore = Ext.create("Ext.data.Store", {
fields: ["cellvalue", "rowvisible", "groupid", "intval", "strval"]
});
var selectionModel = Ext.create("Ext.selection.CheckboxModel", {
mode: "SIMPLE",
listeners: {
deselect: function (obj, record, index) {
me.chCustomFilter.getValue() && me.chCustomFilter.setValue(false);
record.ischecked = false;
if (record.data.rowvisible == "ever") {
obj.deselectAll();
me.cellsStore.getRange(1).forEach(function (rec) {
rec.ischecked = false;
});
} else {
var srecord = me.cellList.getStore().getAt(0);
if (srecord.data.rowvisible == "ever" && obj.isSelected(srecord)) {
srecord.ischecked = false;
obj.deselect(srecord, true);
}
}
},
select: function (obj, record, index) {
me.chCustomFilter.getValue() && me.chCustomFilter.setValue(false);
record.ischecked = true;
if (record.data.rowvisible == "ever") {
obj.select(me.cellList.getStore().getRange(1), false, true);
obj.select(me.cellList.getStore().getAt(0), true, true);
me.cellsStore.getRange(1).forEach(function (rec) {
rec.ischecked = true;
});
}
}
}
});
this.cellList = Ext.create("Ext.grid.Panel", {
activeItem: 0,
selModel: selectionModel,
store: this.cellsStore,
stateful: true,
stateId: "stateGrid",
scroll: false,
columns: [{
flex: 1,
sortable: false,
dataIndex: "cellvalue"
}],
height: 160,
hideHeaders: true,
style: "margin: 0 0 14px 0",
viewConfig: {
stripeRows: false
},
plugins: [{
ptype: "gridscrollpane"
}]
});
var btnOk = Ext.create("Ext.Button", {
text: Ext.Msg.buttonText.ok,
width: 80,
cls: "asc-blue-button",
listeners: {
click: function () {
if (!selectionModel.getCount()) {
Ext.Msg.show({
title: me.textWarning,
msg: me.warnNoSelected,
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OK
});
} else {
me.fireEvent("onmodalresult", me, me.chCustomFilter.getValue() ? 0 : 1);
me.close();
}
}
}
});
var btnCancel = Ext.create("Ext.Button", {
text: me.cancelButtonText,
width: 80,
listeners: {
click: function () {
me.fireEvent("onmodalresult", me, 0);
me.close();
}
}
});
this.items = [{
xtype: "container",
height: 30,
layout: {
type: "hbox"
},
items: [this.btnSortAsc, this.btnSortDesc, {
xtype: "tbspacer",
flex: 1
},
this.chCustomFilter, btnCustomFilter]
},
txtSearch, this.cellList, {
xtype: "container",
width: 250,
layout: "hbox",
layoutConfig: {
align: "stretch"
},
items: [{
xtype: "tbspacer",
flex: 1
},
btnOk, {
xtype: "tbspacer",
width: 5
},
btnCancel]
}];
this.callParent(arguments);
this.setTitle(this.txtTitle);
},
afterRender: function () {
this.callParent(arguments);
this._setDefaults();
},
setSettings: function (config) {
var arr = [{
cellvalue: this.textSelectAll,
rowvisible: "ever",
groupid: "0"
}];
var isnumber, value;
config.asc_getResult().forEach(function (item) {
value = item.asc_getVal();
isnumber = Ext.isNumeric(value);
arr.push({
cellvalue: value,
rowvisible: item.asc_getVisible(),
groupid: "1",
intval: isnumber ? parseFloat(value) : undefined,
strval: !isnumber ? value : ""
});
});
this.cellsStore.loadData(arr);
this.cellsStore.group("groupid");
this._defaults = [];
this._defaults.properties = config;
},
getSettings: function () {
var ret_out = new Asc.AutoFiltersOptions();
ret_out.asc_setCellId(this._defaults.properties.asc_getCellId());
var result_arr = [],
visibility,
me = this;
this.cellsStore.clearFilter(true);
var records = this.cellsStore.getRange(1);
records.forEach(function (item) {
if ((visibility = item.get("rowvisible")) != "hidden") {
visibility = me.cellList.getSelectionModel().isSelected(item);
}
result_arr.push(new Asc.AutoFiltersOptionsElements(item.get("cellvalue"), visibility));
});
ret_out.asc_setResult(result_arr);
ret_out.sortState = this._defaults.properties.asc_getSortState();
return ret_out;
},
_setDefaults: function () {
var sort = this._defaults.properties.asc_getSortState();
if (sort) {
this[sort == "ascending" ? "btnSortAsc" : "btnSortDesc"].toggle(true, true);
}
var store = this.cellList.getStore(),
selectionModel = this.cellList.getSelectionModel();
store.filter("rowvisible", /^((?!hidden).)*$/);
var count = store.getCount(),
item,
isSelectAll = true;
while (count > 1) {
item = store.getAt(--count);
if (item.data.rowvisible === true) {
selectionModel.select(item, true, true);
item.ischecked = true;
} else {
isSelectAll = false;
}
}
if (isSelectAll) {
store.getAt(0).ischecked = true;
selectionModel.select(0, true, true);
}
this.chCustomFilter.setValue(this._defaults.properties.asc_getIsCustomFilter() === true);
},
btnCustomFilter: "Custom Filter",
textSelectAll: "Select All",
txtTitle: "Filter",
warnNoSelected: "You must choose at least one value",
textWarning: "Warning",
cancelButtonText: "Cancel",
txtEmpty: "Enter cell's filter"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["common/main/lib/component/Window"], function () {
SSE.Views = SSE.Views || {};
SSE.Views.DigitalFilterDialog = Common.UI.Window.extend(_.extend({
initialize: function (options) {
var t = this,
_options = {};
_.extend(_options, {
width: 500,
height: 230,
contentWidth: 180,
header: true,
cls: "filter-dlg",
contentTemplate: "",
title: t.txtTitle,
items: []
},
options);
this.template = options.template || ['<div class="box" style="height:' + (_options.height - 85) + 'px;">', '<div class="content-panel" >', '<label class="header">', t.textShowRows, "</label>", '<div style="margin-top:15px;">', '<div id="id-search-begin-digital-combo" class="input-group-nr" style="vertical-align:top;width:225px;display:inline-block;"></div>', '<div id="id-sd-cell-search-begin" class="" style="width:225px;display:inline-block;margin-left:18px;"></div>', "</div>", "<div>", '<div id="id-and-radio" class="padding-small" style="display: inline-block; margin-top:10px;"></div>', '<div id="id-or-radio" class="padding-small" style="display: inline-block; margin-left:25px;"></div>', "</div>", '<div style="margin-top:10px;">', '<div id="id-search-end-digital-combo" class="input-group-nr" style="vertical-align:top;width:225px;display:inline-block;"></div>', '<div id="id-sd-cell-search-end" class="" style="width:225px;display:inline-block;margin-left:18px;"></div>', "</div>", "</div>", "</div>", '<div class="separator horizontal" style="width:100%"></div>', '<div class="footer right" style="margin-left:-15px;">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">', t.okButtonText, "</button>", '<button class="btn normal dlg-btn" result="cancel">', t.cancelButtonText, "</button>", "</div>"].join("");
this.api = options.api;
this.handler = options.handler;
_options.tpl = _.template(this.template, _options);
Common.UI.Window.prototype.initialize.call(this, _options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var conditions = [{
value: c_oAscCustomAutoFilter.equals,
displayValue: this.capCondition1
},
{
value: c_oAscCustomAutoFilter.doesNotEqual,
displayValue: this.capCondition2
},
{
value: c_oAscCustomAutoFilter.isGreaterThan,
displayValue: this.capCondition3
},
{
value: c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,
displayValue: this.capCondition4
},
{
value: c_oAscCustomAutoFilter.isLessThan,
displayValue: this.capCondition5
},
{
value: c_oAscCustomAutoFilter.isLessThanOrEqualTo,
displayValue: this.capCondition6
},
{
value: c_oAscCustomAutoFilter.beginsWith,
displayValue: this.capCondition7
},
{
value: c_oAscCustomAutoFilter.doesNotBeginWith,
displayValue: this.capCondition8
},
{
value: c_oAscCustomAutoFilter.endsWith,
displayValue: this.capCondition9
},
{
value: c_oAscCustomAutoFilter.doesNotEndWith,
displayValue: this.capCondition10
},
{
value: c_oAscCustomAutoFilter.contains,
displayValue: this.capCondition11
},
{
value: c_oAscCustomAutoFilter.doesNotContain,
displayValue: this.capCondition12
}];
this.cmbCondition1 = new Common.UI.ComboBox({
el: $("#id-search-begin-digital-combo", this.$window),
menuStyle: "min-width: 225px;",
cls: "input-group-nr",
data: conditions,
editable: false
});
this.cmbCondition1.setValue(c_oAscCustomAutoFilter.equals);
conditions.splice(0, 0, {
value: 0,
displayValue: this.textNoFilter
});
this.cmbCondition2 = new Common.UI.ComboBox({
el: $("#id-search-end-digital-combo", this.$window),
menuStyle: "min-width: 225px;",
cls: "input-group-nr",
data: conditions,
editable: false
});
this.cmbCondition2.setValue(0);
this.rbAnd = new Common.UI.RadioBox({
el: $("#id-and-radio", this.$window),
labelText: this.capAnd,
name: "asc-radio-filter-tab",
checked: true
});
this.rbOr = new Common.UI.RadioBox({
el: $("#id-or-radio", this.$window),
labelText: this.capOr,
name: "asc-radio-filter-tab"
});
this.txtValue1 = new Common.UI.InputField({
el: $("#id-sd-cell-search-begin", this.$window),
template: _.template(['<div class="input-field" style="<%= style %>">', "<input ", 'type="<%= type %>" ', 'name="<%= name %>" ', 'class="form-control <%= cls %>" style="float:none" ', 'placeholder="<%= placeHolder %>" ', 'value="<%= value %>"', ">", "</div>"].join("")),
allowBlank: true,
validation: function () {
return true;
}
});
this.txtValue2 = new Common.UI.InputField({
el: $("#id-sd-cell-search-end", this.$window),
template: _.template(['<div class="input-field" style="<%= style %>">', "<input ", 'type="<%= type %>" ', 'name="<%= name %>" ', 'class="form-control <%= cls %>" style="float:none" ', 'placeholder="<%= placeHolder %>" ', 'value="<%= value %>"', ">", "</div>"].join("")),
allowBlank: true,
validation: function () {
return true;
}
});
this.$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
this.loadDefaults();
},
show: function () {
Common.UI.Window.prototype.show.call(this);
var me = this;
_.defer(function () {
if (me.txtValue1) {
me.txtValue1.focus();
}
},
500);
},
close: function () {
if (this.api) {
this.api.asc_enableKeyEvents(true);
}
Common.UI.Window.prototype.close.call(this);
},
onBtnClick: function (event) {
if (event.currentTarget.attributes && event.currentTarget.attributes.result) {
if ("ok" === event.currentTarget.attributes.result.value) {
this.save();
}
this.close();
}
},
setSettings: function (properties) {
this.properties = properties;
},
loadDefaults: function () {
if (this.properties && this.rbOr && this.rbAnd && this.cmbCondition1 && this.cmbCondition2 && this.txtValue1 && this.txtValue2) {
(this.properties.asc_getIsChecked()) ? this.rbOr.setValue(true) : this.rbAnd.setValue(true);
this.cmbCondition1.setValue(this.properties.asc_getFilter1() || c_oAscCustomAutoFilter.equals);
this.cmbCondition2.setValue(this.properties.asc_getFilter2() || 0);
this.txtValue1.setValue(null === this.properties.asc_getValFilter1() ? "" : this.properties.asc_getValFilter1());
this.txtValue2.setValue(null === this.properties.asc_getValFilter2() ? "" : this.properties.asc_getValFilter2());
}
},
save: function () {
if (this.api && this.properties && this.rbOr && this.rbAnd && this.cmbCondition1 && this.cmbCondition2 && this.txtValue1 && this.txtValue2) {
var options = new Asc.AutoFiltersOptions();
if (options) {
options.asc_setCellId(this.properties.asc_getCellId());
options.asc_setIsChecked(this.rbOr.getValue());
options.asc_setFilter1(this.cmbCondition1.getValue());
options.asc_setFilter2(this.cmbCondition2.getValue() || undefined);
options.asc_setValFilter1(this.txtValue1.getValue());
options.asc_setValFilter2(this.txtValue2.getValue());
this.api.asc_applyAutoFilter("digitalFilter", options);
}
}
},
onPrimary: function () {
this.save();
this.close();
return false;
},
cancelButtonText: "Cancel",
capAnd: "And",
capCondition1: "equals",
capCondition10: "does not end with",
capCondition11: "contains",
capCondition12: "does not contain",
capCondition2: "does not equal",
capCondition3: "is greater than",
capCondition4: "is greater than or equal to",
capCondition5: "is less than",
capCondition6: "is less than or equal to",
capCondition7: "begins with",
capCondition8: "does not begin with",
capCondition9: "ends with",
capOr: "Or",
textNoFilter: "no filter",
textShowRows: "Show rows where",
textUse1: "Use ? to present any single character",
textUse2 : "Use * to present any series of character",
txtTitle: "Custom Filter"
},
SSE.Views.DigitalFilterDialog || {}));
SSE.Views.AutoFilterDialog = Common.UI.Window.extend(_.extend({
initialize: function (options) {
var t = this,
_options = {};
_.extend(_options, {
width: 270,
height: 450,
contentWidth: 400,
header: true,
cls: "filter-dlg",
contentTemplate: "",
title: t.txtTitle,
items: []
},
options);
this.template = options.template || ['<div class="box" style="height:' + (_options.height - 85) + 'px;">', '<div class="content-panel">', '<div class="">', '<div id="id-btn-sort-down" class="btn-placeholder border"></div>', '<div id="id-btn-sort-up" class="btn-placeholder border"></div>', '<div id="id-checkbox-custom-filter" style="max-width:50px;margin-left:50px;display:inline-block;"></div>', '<button class="btn normal dlg-btn primary" result="custom" id="id-btn-custom-filter" style="min-width:120px;">', t.btnCustomFilter, "</button>", '<div id="id-sd-cell-search" class="input-row" style="margin-bottom:10px;"></div>', '<div class="border-values" style="margin-top:45px;">', '<div id="id-dlg-filter-values" class="combo-values"/>', "</div>", "</div>", "</div>", "</div>", '<div class="separator horizontal"></div>', '<div class="footer center">', '<div id="id-apply-filter" style="display: inline-block;"></div>', '<button class="btn normal dlg-btn" result="cancel">', t.cancelButtonText, "</button>", "</div>"].join("");
this.api = options.api;
this.handler = options.handler;
this.throughIndexes = [];
_options.tpl = _.template(this.template, _options);
Common.UI.Window.prototype.initialize.call(this, _options);
},
render: function () {
var me = this;
Common.UI.Window.prototype.render.call(this);
this.$window.find(".btn").on("click", _.bind(this.onBtnClick, this));
this.btnOk = new Common.UI.Button({
cls: "btn normal dlg-btn primary",
caption: this.okButtonText,
style: "margin-right:10px;",
enableToggle: false,
allowDepress: false
});
if (this.btnOk) {
this.btnOk.render($("#id-apply-filter", this.$window));
this.btnOk.on("click", _.bind(this.onApplyFilter, this));
}
this.btnSortDown = new Common.UI.Button({
cls: "btn-toolbar btn-toolbar-default border",
iconCls: "btn-icon btn-sort-down",
pressed: true,
enableToggle: true,
allowDepress: false
});
if (this.btnSortDown) {
this.btnSortDown.render($("#id-btn-sort-down", this.$window));
this.btnSortDown.on("click", _.bind(this.onSortType, this, "ascending"));
}
this.btnSortUp = new Common.UI.Button({
cls: "btn-toolbar btn-toolbar-default border",
iconCls: "btn-icon btn-sort-up",
pressed: true,
enableToggle: true,
allowDepress: false
});
if (this.btnSortUp) {
this.btnSortUp.render($("#id-btn-sort-up", this.$window));
this.btnSortUp.on("click", _.bind(this.onSortType, this, "descending"));
}
this.chCustomFilter = new Common.UI.CheckBox({
el: $("#id-checkbox-custom-filter", this.$window)
});
this.chCustomFilter.setDisabled(true);
this.btnCustomFilter = new Common.UI.Button({
el: $("#id-btn-custom-filter", this.$window)
}).on("click", _.bind(this.onShowCustomFilterDialog, this));
this.input = new Common.UI.InputField({
el: $("#id-sd-cell-search", this.$window),
allowBlank: true,
placeHolder: this.txtEmpty,
style: "margin-top: 10px;",
validateOnChange: true,
validation: function () {
return true;
}
}).on("changing", function (input, value) {
if (value.length) {
value = value.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
me.filter = new RegExp(value, "ig");
} else {
me.filter = undefined;
}
me.setupDataCells();
});
this.cells = new Common.UI.DataViewStore();
this.filterExcludeCells = new Common.UI.DataViewStore();
if (this.cells) {
this.cellsList = new Common.UI.ListView({
el: $("#id-dlg-filter-values", this.$window),
store: this.cells,
template: _.template(['<div class="listview inner" style="border:none;"></div>'].join("")),
itemTemplate: _.template(["<div>", '<label class="checkbox-indeterminate" style="position:absolute;">', "<% if (!check) { %>", '<input type="button"/>', "<% } else { %>", '<input type="button" class="checked"/>', "<% } %>", "</label>", '<div id="<%= id %>" class="list-item" style="pointer-events:none;margin-left:20px;display:inline-block;"><%= value %></div>', "</div>"].join(""))
});
this.cellsList.on("item:select", _.bind(this.onCellCheck, this));
this.cellsList.onKeyDown = _.bind(this.onListKeyDown, this);
}
this.setupListCells();
},
show: function () {
Common.UI.Window.prototype.show.call(this);
var me = this;
if (this.input) {
_.delay(function () {
me.input.$el.find("input").focus();
},
500, this);
}
},
onBtnClick: function (event) {
if (event.currentTarget.attributes && event.currentTarget.attributes.result) {
if ("cancel" === event.currentTarget.attributes.result.value) {
this.close();
}
}
},
onApplyFilter: function () {
if (this.testFilter()) {
this.save();
this.close();
}
},
onSortType: function (type) {
if (this.api && this.configTo) {
this.api.asc_sortColFilter(type, this.configTo.asc_getCellId());
}
this.close();
},
onShowCustomFilterDialog: function () {
var me = this,
dlgDigitalFilter = new SSE.Views.DigitalFilterDialog({
api: this.api
}).on({
"close": function () {
me.close();
}
});
dlgDigitalFilter.setSettings(this.configTo);
dlgDigitalFilter.show();
this.close();
},
onCellCheck: function (listView, itemView, record) {
if (this.checkCellTrigerBlock) {
return;
}
var target = "",
type = "",
isLabel = false,
bound = null;
var event = window.event ? window.event : window._event;
if (event) {
type = event.target.type;
target = $(event.currentTarget).find(".list-item");
if (target.length) {
bound = target.get(0).getBoundingClientRect();
if (bound.left < event.clientX && event.clientX < bound.right && bound.top < event.clientY && event.clientY < bound.bottom) {
isLabel = true;
}
}
if (type === "button" || isLabel) {
this.updateCellCheck(listView, record);
_.delay(function () {
listView.$el.find(".listview").focus();
},
100, this);
}
}
},
onListKeyDown: function (e, data) {
var record = null,
listView = this.cellsList;
if (listView.disabled) {
return;
}
if (_.isUndefined(undefined)) {
data = e;
}
if (data.keyCode == Common.UI.Keys.SPACE) {
data.preventDefault();
data.stopPropagation();
this.updateCellCheck(listView, listView.getSelectedRec()[0]);
} else {
Common.UI.DataView.prototype.onKeyDown.call(this.cellsList, e, data);
}
},
updateCellCheck: function (listView, record) {
if (record && listView) {
listView.isSuspendEvents = true;
if ("1" !== record.get("groupid")) {
var check = !record.get("check");
this.cells.each(function (cell) {
cell.set("check", check);
});
} else {
record.set("check", !record.get("check"));
}
this.chCustomFilter.setValue(false);
this.btnOk.setDisabled(false);
listView.isSuspendEvents = false;
listView.scroller.update({
minScrollbarLength: 40,
alwaysVisibleY: true
});
}
},
setSettings: function (config) {
this.config = config;
this.configTo = config;
},
setupListCells: function () {
function isNumeric(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
var me = this,
isnumber, value, index = 0,
haveUnselectedCell = false,
throughIndex = 1,
isCustomFilter = (this.configTo.asc_getIsCustomFilter() === true);
if (_.isUndefined(this.config)) {
return;
}
this.cells.reset();
this.filterExcludeCells.reset();
me.cells.push(new Common.UI.DataViewModel({
id: ++index,
selected: false,
allowSelected: true,
value: this.textSelectAll,
groupid: "0",
check: true,
throughIndex: 0
}));
this.throughIndexes.push(true);
this.config.asc_getResult().forEach(function (item) {
value = item.asc_getVal();
isnumber = isNumeric(value);
if ("hidden" !== item.asc_getVisible()) {
me.cells.push(new Common.UI.DataViewModel({
id: ++index,
selected: false,
allowSelected: true,
cellvalue: value,
value: isnumber ? value : (value.length > 0 ? value : me.textEmptyItem),
rowvisible: item.asc_getVisible(),
intval: isnumber ? parseFloat(value) : undefined,
strval: !isnumber ? value : "",
groupid: "1",
check: item.asc_getVisible(),
throughIndex: throughIndex
}));
if (!item.asc_getVisible()) {
haveUnselectedCell = true;
}
me.throughIndexes.push(item.asc_getVisible());
++throughIndex;
}
});
this.checkCellTrigerBlock = true;
this.cells.at(0).set("check", !haveUnselectedCell);
this.checkCellTrigerBlock = undefined;
this.btnSortDown.toggle(false, false);
this.btnSortUp.toggle(false, false);
var sort = this.config.asc_getSortState();
if (sort) {
if ("ascending" === sort) {
this.btnSortDown.toggle(true, false);
} else {
this.btnSortUp.toggle(true, false);
}
}
this.chCustomFilter.setValue(isCustomFilter);
this.btnOk.setDisabled(isCustomFilter);
this.cellsList.scroller.update({
minScrollbarLength: 40,
alwaysVisibleY: true
});
this.config = undefined;
},
setupDataCells: function () {
function isNumeric(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
var me = this,
isnumber, value, index = 0,
applyfilter = true,
throughIndex = 1;
this.cells.forEach(function (item) {
value = item.get("check");
if (_.isUndefined(value)) {
value = false;
}
me.throughIndexes[parseInt(item.get("throughIndex"))] = item.get("check");
});
this.cells.reset();
this.filterExcludeCells.reset();
if (!me.filter) {
me.cells.push(new Common.UI.DataViewModel({
id: ++index,
selected: false,
allowSelected: true,
value: this.textSelectAll,
groupid: "0",
check: me.throughIndexes[0],
throughIndex: 0
}));
}
this.configTo.asc_getResult().forEach(function (item) {
value = item.asc_getVal();
isnumber = isNumeric(value);
applyfilter = true;
if (me.filter) {
if (null === value.match(me.filter)) {
applyfilter = false;
}
}
if ("hidden" !== item.asc_getVisible()) {
if (applyfilter) {
me.cells.push(new Common.UI.DataViewModel({
id: ++index,
selected: false,
allowSelected: true,
cellvalue: value,
value: isnumber ? value : (value.length > 0 ? value : me.textEmptyItem),
rowvisible: item.asc_getVisible(),
intval: isnumber ? parseFloat(value) : undefined,
strval: !isnumber ? value : "",
groupid: "1",
check: me.throughIndexes[throughIndex],
throughIndex: throughIndex
}));
} else {
me.filterExcludeCells.push(new Common.UI.DataViewModel({
cellvalue: value
}));
}++throughIndex;
}
});
if (this.cells.length) {
this.chCustomFilter.setValue(this.configTo.asc_getIsCustomFilter() === true);
}
this.cellsList.scroller.update({
minScrollbarLength: 40,
alwaysVisibleY: true
});
},
testFilter: function () {
var me = this,
isValid = false;
if (this.cells) {
this.cells.forEach(function (item) {
if ("1" === item.get("groupid")) {
if (item.get("check")) {
isValid = true;
}
}
});
}
if (!isValid) {
Common.UI.warning({
title: this.textWarning,
msg: this.warnNoSelected,
callback: function () {
_.delay(function () {
me.input.$el.find("input").focus();
},
100, this);
}
});
}
return isValid;
},
save: function () {
if (this.api && this.configTo && this.cells && this.filterExcludeCells) {
var options = new Asc.AutoFiltersOptions();
if (options) {
options.asc_setCellId(this.configTo.asc_getCellId());
var me = this,
result_arr = [],
visibility;
this.cells.forEach(function (item) {
if ("1" === item.get("groupid")) {
if ((visibility = item.get("rowvisible")) !== "hidden") {
visibility = item.get("check");
result_arr.push(new Asc.AutoFiltersOptionsElements(item.get("cellvalue"), visibility));
}
}
});
this.filterExcludeCells.forEach(function (item) {
result_arr.push(new Asc.AutoFiltersOptionsElements(item.get("cellvalue"), false));
});
options.asc_setResult(result_arr);
options.sortState = this.configTo.asc_getSortState();
this.api.asc_applyAutoFilter("mainFilter", options);
}
}
},
onPrimary: function () {
this.save();
this.close();
return false;
},
okButtonText: "Ok",
btnCustomFilter: "Custom Filter",
textSelectAll: "Select All",
txtTitle: "Filter",
warnNoSelected: "You must choose at least one value",
textWarning: "Warning",
cancelButtonText: "Cancel",
textEmptyItem: "{Blanks}",
txtEmpty: "Enter cell's filter"
},
SSE.Views.AutoFilterDialog || {}));
});

View File

@@ -1,64 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.RecentFiles", {
extend: "Ext.app.Controller",
views: ["RecentFiles"],
stores: ["RecentFiles"],
refs: [{
ref: "filePanel",
selector: "ssefile"
}],
init: function () {
this.control({
"sserecentfiles dataview": {
itemclick: this.onRecentFileClick
}
});
},
loadConfig: function (data) {
var recent = this.getRecentFilesStore();
if (recent && data && data.config && data.config.recent) {
recent.removeAll();
recent.add(data.config.recent);
}
},
onRecentFileClick: function (view, record, item, index, e) {
var filePanel = this.getFilePanel();
if (filePanel) {
filePanel.closeMenu();
}
var recentDocPage = window.open(record.data.url);
if (recentDocPage) {
recentDocPage.focus();
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/CellEditor.template", "common/main/lib/component/BaseView"], function (template) {
SSE.Views.CellEditor = Common.UI.BaseView.extend({
template: _.template(template),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
},
render: function () {
$(this.el).html(this.template());
this.$cellname = $("#ce-cell-name", this.el);
this.$btnexpand = $("#ce-btn-expand", this.el);
this.$btnfunc = $("#ce-func-label", this.el);
this.$btnfunc.addClass("disabled");
this.$btnfunc.tooltip({
title: this.tipFormula,
placement: "cursor"
});
return this;
},
updateCellInfo: function (info) {
if (info) {
this.$cellname.val(typeof(info) == "string" ? info : info.asc_getName());
}
},
tipFormula: "Insert Function"
},
SSE.Views.CellEditor || {});
});

View File

@@ -1,141 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.CellInfo", {
extend: "Ext.container.Container",
alias: "widget.ssecellinfo",
cls: "sse-cellinfo",
uses: ["SSE.view.FormulaDialog"],
height: 23,
initComponent: function () {
var me = this;
this.addEvents("editcomplete");
this.txtName = Ext.widget("textfield", {
id: "infobox-cell-name",
width: 70,
height: this.height,
cls: "asc-input-aslabel",
fieldStyle: "border-radius:0;"
});
this._cellInput = Ext.widget("textarea", {
id: "infobox-cell-edit",
inputId: "infobox-cell-input",
flex: 1,
style: "margin:0;opacity:1;",
fieldStyle: "border-radius:0;font-size:14px;padding:0 3px;line-height:21px;",
enableKeyEvents: true,
enterIsSpecial: true
});
var style = "padding:4px 0 0 4px;border-bottom:solid 1px #AFAFAF; background:#E9E9E9 url(resources/img/toolbar-menu.png) no-repeat 0 -1416px;";
style += 'background-image: -webkit-image-set(url("resources/img/toolbar-menu.png") 1x, url("resources/img/toolbar-menu@2x.png") 2x);';
this._lblFunct = Ext.widget("box", {
width: 20,
height: this.height,
id: "func-label-box",
style: style,
listeners: {
afterrender: function (c) {
$("#func-label-box").hover(function () {
this.style.backgroundPosition = this.mdown ? "-40px -1416px" : "-20px -1416px";
},
function () {
this.style.backgroundPosition = "0 -1416px";
});
$("#func-label-box").mousedown(function () {
this.style.backgroundPosition = "-40px -1416px";
var hdown = this;
hdown.mdown = true;
var upHandler = function () {
hdown.mdown = false;
$(document).unbind("mouseup", upHandler);
};
$(document).mouseup(upHandler);
});
$("#func-label-box").click(function (e) {
if (me.permissions.isEdit) {
dlgFormulas.addListener("onmodalresult", function (o, mr, s) {
me.fireEvent("editcomplete", me);
},
me, {
single: true
});
dlgFormulas.show();
}
});
}
}
});
this.keep_height = 180;
var btnExpand = Ext.widget("button", {
width: 16,
height: this.height,
id: "infobox-cell-multiline-button",
style: "border-radius: 0;",
iconCls: "infobox-cell-multiline-button"
});
Ext.apply(me, {
style: "overflow:visible;",
layout: {
type: "hbox",
align: "stretch"
},
items: [{
xtype: "container",
cls: "infobox-container-border",
id: "infobox-container-cell-name",
width: 90,
layout: {
type: "hbox"
},
items: [this.txtName, this._lblFunct]
},
this._cellInput, {
xtype: "container",
items: [btnExpand]
}]
},
me.initialConfig);
me.callParent(arguments);
},
updateCellInfo: function (info) {
if (info) {
this.txtName.setValue(typeof(info) == "string" ? info : info.asc_getName());
}
},
setMode: function (m) {
if (m.isDisconnected) {
this.permissions.isEdit = false;
} else {
this.permissions = m;
}
$("#" + this._lblFunct.id).css("cursor", m.isEdit ? "pointer" : "default");
}
});

View File

@@ -0,0 +1,126 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
define(["common/main/lib/component/InputField", "common/main/lib/component/Window"], function () {
SSE.Views.CellRangeDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
cls: "modal-dlg",
modal: false
},
initialize: function (options) {
_.extend(this.options, {
title: this.txtTitle
},
options);
this.template = ['<div class="box">', '<div id="id-dlg-cell-range" class="input-row" style="margin-bottom: 5px;"></div>', "</div>", '<div class="footer right">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + "</button>", '<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + "</button>", "</div>"].join("");
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild(),
me = this;
me.inputRange = new Common.UI.InputField({
el: $("#id-dlg-cell-range"),
name: "range",
style: "width: 100%;",
allowBlank: false,
blankError: this.txtEmpty,
validateOnChange: true
});
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
me.inputRange.cmpEl.find("input").on("keypress", _.bind(this.onKeyPress, this));
this.on("close", _.bind(this.onClose, this));
},
onPrimary: function () {
this._handleInput("ok");
return false;
},
setSettings: function (settings) {
var me = this;
this.inputRange.setValue(settings.range ? settings.range : "");
if (settings.api) {
me.api = settings.api;
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.Chart, settings.range ? settings.range : "");
me.api.asc_registerCallback("asc_onSelectionRangeChanged", _.bind(me.onApiRangeChanged, me));
Common.NotificationCenter.trigger("cells:range", c_oAscSelectionDialogType.Chart);
}
me.inputRange.validation = function (value) {
var isvalid = me.api.asc_checkDataRange(c_oAscSelectionDialogType.Chart, value, false);
return (isvalid == c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
};
},
getSettings: function () {
return this.inputRange.getValue();
},
onApiRangeChanged: function (info) {
this.inputRange.setValue(info);
if (this.inputRange.cmpEl.hasClass("error")) {
this.inputRange.cmpEl.removeClass("error");
}
},
onBtnClick: function (event) {
this._handleInput(event.currentTarget.attributes["result"].value);
},
onClose: function (event) {
if (this.api) {
this.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.None);
}
Common.NotificationCenter.trigger("cells:range", c_oAscSelectionDialogType.None);
},
onKeyPress: function (event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput("ok");
}
},
_handleInput: function (state) {
if (this.options.handler) {
if (state == "ok") {
if (this.inputRange.checkValidate() !== true) {
return;
}
}
this.options.handler.call(this, this, state);
}
this.close();
},
txtTitle: "Select Data Range",
textCancel: "Cancel",
txtEmpty: "This field is required",
txtInvalidRange: "ERROR! Invalid cells range",
errorMaxRows: "ERROR! The maximum number of data series per chart is 255."
},
SSE.Views.CellRangeDialog || {}));
});

View File

@@ -0,0 +1,538 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/ChartSettings.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/component/MetricSpinner", "spreadsheeteditor/main/app/view/ChartSettingsDlg"], function (menuTemplate, $, _, Backbone) {
SSE.Views.ChartSettings = Backbone.View.extend(_.extend({
el: "#id-chart-settings",
template: _.template(menuTemplate),
events: {},
options: {
alias: "ChartSettings"
},
initialize: function () {
var me = this;
this._initSettings = true;
this._state = {
Width: 0,
Height: 0,
ChartStyle: 1,
ChartType: -1,
SeveralCharts: false,
DisabledControls: false
};
this._nRatio = 1;
this.spinners = [];
this.lockedControls = [];
this._locked = false;
this._noApply = false;
this._originalProps = null;
this.render();
this.btnChartType = new Common.UI.Button({
cls: "btn-large-dataview",
iconCls: "item-chartlist bar-normal",
menu: new Common.UI.Menu({
style: "width: 330px;",
items: [{
template: _.template('<div id="id-chart-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')
}]
})
});
this.btnChartType.on("render:after", function (btn) {
me.mnuChartTypePicker = new Common.UI.DataView({
el: $("#id-chart-menu-type"),
parentMenu: btn.menu,
restoreHeight: 411,
groups: new Common.UI.DataViewGroupStore([{
id: "menu-chart-group-bar",
caption: me.textColumn
},
{
id: "menu-chart-group-line",
caption: me.textLine
},
{
id: "menu-chart-group-pie",
caption: me.textPie
},
{
id: "menu-chart-group-hbar",
caption: me.textBar
},
{
id: "menu-chart-group-area",
caption: me.textArea
},
{
id: "menu-chart-group-scatter",
caption: me.textPoint
},
{
id: "menu-chart-group-stock",
caption: me.textStock
}]),
store: new Common.UI.DataViewStore([{
group: "menu-chart-group-bar",
type: c_oAscChartTypeSettings.barNormal,
iconCls: "column-normal",
selected: true
},
{
group: "menu-chart-group-bar",
type: c_oAscChartTypeSettings.barStacked,
iconCls: "column-stack"
},
{
group: "menu-chart-group-bar",
type: c_oAscChartTypeSettings.barStackedPer,
iconCls: "column-pstack"
},
{
group: "menu-chart-group-line",
type: c_oAscChartTypeSettings.lineNormal,
iconCls: "line-normal"
},
{
group: "menu-chart-group-line",
type: c_oAscChartTypeSettings.lineStacked,
iconCls: "line-stack"
},
{
group: "menu-chart-group-line",
type: c_oAscChartTypeSettings.lineStackedPer,
iconCls: "line-pstack"
},
{
group: "menu-chart-group-pie",
type: c_oAscChartTypeSettings.pie,
iconCls: "pie-normal"
},
{
group: "menu-chart-group-pie",
type: c_oAscChartTypeSettings.doughnut,
iconCls: "pie-doughnut"
},
{
group: "menu-chart-group-hbar",
type: c_oAscChartTypeSettings.hBarNormal,
iconCls: "bar-normal"
},
{
group: "menu-chart-group-hbar",
type: c_oAscChartTypeSettings.hBarStacked,
iconCls: "bar-stack"
},
{
group: "menu-chart-group-hbar",
type: c_oAscChartTypeSettings.hBarStackedPer,
iconCls: "bar-pstack"
},
{
group: "menu-chart-group-area",
type: c_oAscChartTypeSettings.areaNormal,
iconCls: "area-normal"
},
{
group: "menu-chart-group-area",
type: c_oAscChartTypeSettings.areaStacked,
iconCls: "area-stack"
},
{
group: "menu-chart-group-area",
type: c_oAscChartTypeSettings.areaStackedPer,
iconCls: "area-pstack"
},
{
group: "menu-chart-group-scatter",
type: c_oAscChartTypeSettings.scatter,
iconCls: "point-normal"
},
{
group: "menu-chart-group-stock",
type: c_oAscChartTypeSettings.stock,
iconCls: "stock-normal"
}]),
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
});
});
this.btnChartType.render($("#chart-button-type"));
this.mnuChartTypePicker.on("item:click", _.bind(this.onSelectType, this, this.btnChartType));
this.lockedControls.push(this.btnChartType);
this.btnChartStyle = new Common.UI.Button({
cls: "btn-large-dataview",
iconCls: "item-wrap",
menu: new Common.UI.Menu({
menuAlign: "tr-br",
items: [{
template: _.template('<div id="id-chart-menu-style" style="width: 245px; margin: 0 5px;"></div>')
}]
})
});
this.btnChartStyle.on("render:after", function (btn) {
me.mnuChartStylePicker = new Common.UI.DataView({
el: $("#id-chart-menu-style"),
style: "max-height: 411px;",
parentMenu: btn.menu,
store: new Common.UI.DataViewStore(),
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-image: url(<%= imageUrl %>); background-position: 0 0;"></div>')
});
if (me.btnChartStyle.menu) {
me.btnChartStyle.menu.on("show:after", function () {
me.mnuChartStylePicker.scroller.update({
alwaysVisibleY: true
});
});
}
});
this.btnChartStyle.render($("#chart-button-style"));
this.mnuChartStylePicker.on("item:click", _.bind(this.onSelectStyle, this, this.btnChartStyle));
this.lockedControls.push(this.btnChartStyle);
this.spnWidth = new Common.UI.MetricSpinner({
el: $("#chart-spin-width"),
step: 0.1,
width: 78,
defaultUnit: "cm",
value: "3 cm",
maxValue: 55.88,
minValue: 0
});
this.spinners.push(this.spnWidth);
this.lockedControls.push(this.spnWidth);
this.spnHeight = new Common.UI.MetricSpinner({
el: $("#chart-spin-height"),
step: 0.1,
width: 78,
defaultUnit: "cm",
value: "3 cm",
maxValue: 55.88,
minValue: 0
});
this.spinners.push(this.spnHeight);
this.lockedControls.push(this.spnHeight);
this.spnWidth.on("change", _.bind(this.onWidthChange, this));
this.spnHeight.on("change", _.bind(this.onHeightChange, this));
this.btnRatio = new Common.UI.Button({
cls: "btn-toolbar btn-toolbar-default",
iconCls: "advanced-btn-ratio",
style: "margin-bottom: 1px;",
enableToggle: true,
hint: this.textKeepRatio
});
this.btnRatio.render($("#chart-button-ratio"));
this.lockedControls.push(this.btnRatio);
var value = window.localStorage.getItem("sse-settings-chartratio");
if (value !== null && parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
this.btnRatio.on("click", _.bind(function (btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue() > 0) {
this._nRatio = this.spnWidth.getNumberValue() / this.spnHeight.getNumberValue();
}
window.localStorage.setItem("sse-settings-chartratio", (btn.pressed) ? 1 : 0);
},
this));
$(this.el).on("click", "#chart-advanced-link", _.bind(this.openAdvancedSettings, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
scope: this
}));
this.linkAdvanced = $("#chart-advanced-link");
},
setApi: function (api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback("asc_onUpdateChartStyles", _.bind(this._onUpdateChartStyles, this));
}
return this;
},
ChangeSettings: function (props) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
this.disableControls(this._locked);
if (this.api && props && props.asc_getChartProperties()) {
this._originalProps = new Asc.asc_CImgProperty(props);
this._noApply = true;
this.chartProps = props.asc_getChartProperties();
var value = props.asc_getSeveralCharts() || this._locked;
if (this._state.SeveralCharts !== value) {
this.linkAdvanced.toggleClass("disabled", value);
this._state.SeveralCharts = value;
}
value = props.asc_getSeveralChartTypes();
if (this._state.SeveralCharts && value) {
this.btnChartType.setIconCls("");
this._state.ChartType = null;
} else {
var type = this.chartProps.getType();
if (this._state.ChartType !== type) {
var record = this.mnuChartTypePicker.store.findWhere({
type: type
});
this.mnuChartTypePicker.selectRecord(record, true);
if (record) {
this.btnChartType.setIconCls("item-chartlist " + record.get("iconCls"));
}
this.updateChartStyles(this.api.asc_getChartPreviews(type));
this._state.ChartType = type;
}
}
value = props.asc_getSeveralChartStyles();
if (this._state.SeveralCharts && value) {
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", "none");
this.mnuChartStylePicker.selectRecord(null, true);
this._state.ChartStyle = null;
} else {
value = this.chartProps.getStyle();
if (this._state.ChartStyle !== value) {
var record = this.mnuChartStylePicker.store.findWhere({
data: value
});
this.mnuChartStylePicker.selectRecord(record, true);
if (record) {
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", "url(" + record.get("imageUrl") + ")");
}
this._state.ChartStyle = value;
}
}
this._noApply = false;
value = props.asc_getWidth();
if (Math.abs(this._state.Width - value) > 0.001 || (this._state.Width === null || value === null) && (this._state.Width !== value)) {
this.spnWidth.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : "", true);
this._state.Width = value;
}
value = props.asc_getHeight();
if (Math.abs(this._state.Height - value) > 0.001 || (this._state.Height === null || value === null) && (this._state.Height !== value)) {
this.spnHeight.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : "", true);
this._state.Height = value;
}
if (props.asc_getHeight() > 0) {
this._nRatio = props.asc_getWidth() / props.asc_getHeight();
}
}
},
updateMetricUnit: function () {
if (this.spinners) {
for (var i = 0; i < this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
createDelayedElements: function () {
this.updateMetricUnit();
},
onWidthChange: function (field, newValue, oldValue, eOpts) {
var w = field.getNumberValue();
var h = this.spnHeight.getNumberValue();
if (this.btnRatio.pressed) {
h = w / this._nRatio;
if (h > this.spnHeight.options.maxValue) {
h = this.spnHeight.options.maxValue;
w = h * this._nRatio;
this.spnWidth.setValue(w, true);
}
this.spnHeight.setValue(h, true);
}
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w));
props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h));
this.api.asc_setGraphicObjectProps(props);
}
Common.NotificationCenter.trigger("edit:complete", this);
},
onHeightChange: function (field, newValue, oldValue, eOpts) {
var h = field.getNumberValue(),
w = this.spnWidth.getNumberValue();
if (this.btnRatio.pressed) {
w = h * this._nRatio;
if (w > this.spnWidth.options.maxValue) {
w = this.spnWidth.options.maxValue;
h = w / this._nRatio;
this.spnHeight.setValue(h, true);
}
this.spnWidth.setValue(w, true);
}
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w));
props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h));
this.api.asc_setGraphicObjectProps(props);
}
Common.NotificationCenter.trigger("edit:complete", this);
},
openAdvancedSettings: function () {
if (this.linkAdvanced.hasClass("disabled")) {
return;
}
var me = this;
var win, props;
if (me.api) {
props = me.api.asc_getChartObject();
if (props) {
(new SSE.Views.ChartSettingsDlg({
chartSettings: props,
api: me.api,
handler: function (result, value) {
if (result == "ok") {
if (me.api) {
me.api.asc_editChartDrawingObject(value.chartSettings);
}
}
Common.NotificationCenter.trigger("edit:complete", me);
}
})).show();
}
}
},
onSelectType: function (btn, picker, itemView, record) {
if (this._noApply) {
return;
}
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect) {
if (record.get("selected")) {
rawData = record.toJSON();
} else {
return;
}
} else {
rawData = record;
}
this.btnChartType.setIconCls("item-chartlist " + rawData.iconCls);
this._state.ChartType = -1;
if (this.api && !this._noApply && this.chartProps) {
var props = new Asc.asc_CImgProperty();
this.chartProps.changeType(rawData.type);
props.asc_putChartProperties(this.chartProps);
this.api.asc_setGraphicObjectProps(props);
}
Common.NotificationCenter.trigger("edit:complete", this);
},
onSelectStyle: function (btn, picker, itemView, record) {
if (this._noApply) {
return;
}
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect) {
if (record.get("selected")) {
rawData = record.toJSON();
} else {
return;
}
} else {
rawData = record;
}
var style = "url(" + rawData.imageUrl + ")";
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", style);
if (this.api && !this._noApply && this.chartProps) {
var props = new Asc.asc_CImgProperty();
this.chartProps.putStyle(rawData.data);
props.asc_putChartProperties(this.chartProps);
this.api.asc_setGraphicObjectProps(props);
}
Common.NotificationCenter.trigger("edit:complete", this);
},
_onUpdateChartStyles: function () {
if (this.api && this._state.ChartType !== null && this._state.ChartType > -1) {
this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType));
}
},
updateChartStyles: function (styles) {
var me = this;
if (styles && styles.length > 0) {
var stylesStore = this.mnuChartStylePicker.store;
if (stylesStore) {
var stylearray = [],
selectedIdx = -1,
selectedUrl;
_.each(styles, function (item, index) {
stylearray.push({
imageUrl: item.asc_getImageUrl(),
data: item.asc_getStyle(),
tip: me.textStyle + " " + item.asc_getStyle()
});
if (me._state.ChartStyle == item.asc_getStyle()) {
selectedIdx = index;
selectedUrl = item.asc_getImageUrl();
}
});
stylesStore.reset(stylearray, {
silent: false
});
}
}
this.mnuChartStylePicker.selectByIndex(selectedIdx, true);
if (selectedIdx >= 0 && this.btnChartStyle.cmpEl) {
var style = "url(" + selectedUrl + ")";
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", style);
}
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function (disable) {
if (this._state.DisabledControls !== disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function (item) {
item.setDisabled(disable);
});
this.linkAdvanced.toggleClass("disabled", disable);
}
},
textKeepRatio: "Constant Proportions",
textSize: "Size",
textWidth: "Width",
textHeight: "Height",
textEditData: "Edit Data",
textChartType: "Change Chart Type",
textLine: "Line Chart",
textColumn: "Column Chart",
textBar: "Bar Chart",
textArea: "Area Chart",
textPie: "Pie Chart",
textPoint: "Point Chart",
textStock: "Stock Chart",
textStyle: "Style",
textAdvanced: "Show advanced settings"
},
SSE.Views.ChartSettings || {}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,87 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.CreateFile", {
extend: "Ext.panel.Panel",
alias: "widget.ssecreatenew",
cls: "sse-file-createnew",
layout: {
type: "vbox",
align: "stretch"
},
requires: ["Ext.container.Container", "Ext.data.Model", "Ext.data.Store", "Ext.view.View", "Ext.XTemplate", "Common.plugin.DataViewScrollPane"],
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
this.callParent(arguments);
var me = this;
me.add({
xtype: "container",
html: "<h3>" + me.fromBlankText + "</h3>" + "<hr noshade>" + '<div class="blank-document">' + '<div id="id-create-blank-document" class="btn-blank-document"></div>' + '<div class="blank-document-info">' + "<h3>" + me.newDocumentText + "</h3>" + me.newDescriptionText + "</div>" + "</div>" + '<div style="clear: both;"></div>' + "<h3>" + me.fromTemplateText + "</h3>" + "<hr noshade>"
},
{
xtype: "container",
flex: 1,
layout: "fit",
cls: "container-template-list",
items: [{
xtype: "dataview",
store: "FileTemplates",
tpl: Ext.create("Ext.XTemplate", '<tpl for=".">', '<div class="thumb-wrap">', '<tpl if="this.isEmptyIcon(icon)">', '<div class="thumb"></div>', "</tpl>", '<tpl if="this.isEmptyIcon(icon) == false">', '<div class="thumb" style="background-image: url(' + "'{icon}'" + ');"></div>', "</tpl>", '<div class="title">{name:htmlEncode}</div>', "</div>", "</tpl>", {
isEmptyIcon: function (icon) {
return icon == "";
}
}),
singleSelect: true,
trackOver: true,
autoScroll: true,
overItemCls: "x-item-over",
itemSelector: "div.thumb-wrap",
cls: "x-view-context",
plugins: [{
ptype: "dataviewscrollpane",
pluginId: "scrollpane",
areaSelector: ".x-view-context",
settings: {
enableKeyboardNavigation: true
}
}]
}]
});
},
fromBlankText: "From Blank",
newDocumentText: "New Text Document",
newDescriptionText: "Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",
fromTemplateText: "From Template"
});

View File

@@ -1,276 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.DigitalFilterDialog", {
extend: "Ext.window.Window",
alias: "widget.ssedigitalfilterdialog",
requires: ["Ext.window.Window"],
modal: true,
closable: true,
resizable: false,
height: 226,
width: 500,
constrain: true,
padding: "20px 20px 0 20px",
layout: {
type: "vbox",
align: "stretch"
},
initComponent: function () {
var me = this;
var storeCondition = Ext.create("Ext.data.Store", {
fields: ["condition", "caption"],
data: [{
condition: c_oAscCustomAutoFilter.equals,
caption: me.capCondition1
},
{
condition: c_oAscCustomAutoFilter.doesNotEqual,
caption: me.capCondition2
},
{
condition: c_oAscCustomAutoFilter.isGreaterThan,
caption: me.capCondition3
},
{
condition: c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,
caption: me.capCondition4
},
{
condition: c_oAscCustomAutoFilter.isLessThan,
caption: me.capCondition5
},
{
condition: c_oAscCustomAutoFilter.isLessThanOrEqualTo,
caption: me.capCondition6
},
{
condition: c_oAscCustomAutoFilter.beginsWith,
caption: me.capCondition7
},
{
condition: c_oAscCustomAutoFilter.doesNotBeginWith,
caption: me.capCondition8
},
{
condition: c_oAscCustomAutoFilter.endsWith,
caption: me.capCondition9
},
{
condition: c_oAscCustomAutoFilter.doesNotEndWith,
caption: me.capCondition10
},
{
condition: c_oAscCustomAutoFilter.contains,
caption: me.capCondition11
},
{
condition: c_oAscCustomAutoFilter.doesNotContain,
caption: me.capCondition12
}]
});
this.cmbCondition1 = Ext.create("Ext.form.field.ComboBox", {
store: storeCondition,
displayField: "caption",
valueField: "condition",
queryMode: "local",
typeAhead: false,
style: "margin-right: 10px",
width: 200,
editable: false
});
this.txtValue1 = Ext.create("Ext.form.Text", {
flex: 1,
value: ""
});
this.txtValue2 = Ext.create("Ext.form.Text", {
flex: 1,
value: ""
});
var storeCondition2 = Ext.create("Ext.data.Store", {
fields: ["condition", "caption"],
data: [{
condition: 0,
caption: me.textNoFilter
}]
});
storeCondition2.loadRecords(storeCondition.data.getRange(), {
addRecords: true
});
this.cmbCondition2 = Ext.create("Ext.form.field.ComboBox", {
store: storeCondition2,
displayField: "caption",
valueField: "condition",
queryMode: "local",
typeAhead: false,
style: "margin-right: 10px",
width: 200,
editable: false
});
this.rbMixer = Ext.widget("radiogroup", {
columns: 2,
width: 120,
items: [{
boxLabel: me.capAnd,
name: "mix",
inputValue: "and",
checked: true
},
{
boxLabel: me.capOr,
name: "mix",
inputValue: "or"
}]
});
var btnOk = Ext.create("Ext.Button", {
text: Ext.Msg.buttonText.ok,
width: 80,
cls: "asc-blue-button",
listeners: {
click: function () {
me.fireEvent("onmodalresult", me, 1);
me.close();
}
}
});
var btnCancel = Ext.create("Ext.Button", {
text: me.cancelButtonText,
width: 80,
listeners: {
click: function () {
me.fireEvent("onmodalresult", me, 0);
me.close();
}
}
});
this.items = [{
xtype: "label",
style: "font-weight: bold;margin:0 0 4px 0;",
text: me.textShowRows
},
{
xtype: "container",
style: "margin:10px 0 0 0;",
layout: {
type: "hbox",
align: "middle"
},
items: [this.cmbCondition1, this.txtValue1]
},
{
xtype: "container",
layout: {
type: "hbox",
align: "middle"
},
items: [this.rbMixer]
},
{
xtype: "container",
layout: {
type: "hbox",
align: "middle"
},
items: [this.cmbCondition2, this.txtValue2]
},
{
xtype: "tbspacer",
height: 3
},
{
xtype: "container",
width: 400,
style: "margin:10px 0 0 0;",
layout: {
type: "hbox",
align: "middle"
},
items: [{
xtype: "tbspacer",
flex: 1
},
btnOk, {
xtype: "tbspacer",
width: 5
},
btnCancel]
}];
this.callParent(arguments);
this.setTitle(this.txtTitle);
},
afterRender: function () {
this.callParent(arguments);
this._setDefaults();
},
setSettings: function (config) {
this._defaults = [];
this._defaults.properties = config;
},
getSettings: function () {
var ret_out = new Asc.AutoFiltersOptions();
ret_out.asc_setCellId(this._defaults.properties.asc_getCellId());
ret_out.asc_setIsChecked(this.rbMixer.getValue().mix == "or");
ret_out.asc_setFilter1(this.cmbCondition1.getValue());
ret_out.asc_setFilter2(this.cmbCondition2.getValue() || undefined);
ret_out.asc_setValFilter1(this.txtValue1.getValue());
ret_out.asc_setValFilter2(this.txtValue2.getValue());
return ret_out;
},
_setDefaults: function () {
this.rbMixer.setValue({
mix: this._defaults.properties.asc_getIsChecked() ? "or" : "and"
});
this.cmbCondition1.setValue(this._defaults.properties.asc_getFilter1() || c_oAscCustomAutoFilter.equals);
this.cmbCondition2.setValue(this._defaults.properties.asc_getFilter2() || 0);
this.txtValue1.setValue(this._defaults.properties.asc_getValFilter1());
this.txtValue2.setValue(this._defaults.properties.asc_getValFilter2());
},
txtTitle: "Custom Filter",
capCondition1: "equals",
capCondition2: "does not equal",
capCondition3: "is greater than",
capCondition4: "is greater than or equal to",
capCondition5: "is less than",
capCondition6: "is less than or equal to",
capCondition7: "begins with",
capCondition8: "does not begin with",
capCondition9: "ends with",
capCondition10: "does not end with",
capCondition11: "contains",
capCondition12: "does not contain",
capAnd: "And",
capOr: "Or",
textShowRows: "Show rows where",
textUse1: "Use ? to present any single character",
textUse2 : "Use * to present any series of character",
textNoFilter: "no filter",
cancelButtonText: "Cancel"
});

View File

@@ -1,267 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.model.ModelHelpMenu", {
extend: "Ext.data.Model",
fields: [{
type: "string",
name: "name"
},
{
type: "string",
name: "src"
},
{
type: "string",
name: "headername"
}]
});
Ext.define("SSE.view.DocumentHelp", {
extend: "Ext.container.Container",
alias: "widget.ssedocumenthelp",
cls: "sse-documenthelp-body",
autoScroll: true,
requires: ["Ext.container.Container", "Ext.XTemplate", "Ext.view.View", "Ext.data.Model", "Ext.data.Store", "Common.plugin.DataViewScrollPane"],
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
var me = this;
this.urlPref = "resources/help/en/";
var en_data = [{
src: "UsageInstructions/OpenCreateNew.htm",
name: "Create a new spreadsheet or open an existing one",
headername: "Usage Instructions"
},
{
src: "UsageInstructions/ManageSheets.htm",
name: "Manage sheets"
},
{
src: "UsageInstructions/InsertDeleteCells.htm",
name: "Insert or delete cells, rows, and columns"
},
{
src: "UsageInstructions/CopyPasteData.htm",
name: "Copy and paste data"
},
{
src: "UsageInstructions/FontTypeSizeStyle.htm",
name: "Set font type, size, style, and colors"
},
{
src: "UsageInstructions/AlignText.htm",
name: "Align data in cells"
},
{
src: "UsageInstructions/AddBorders.htm",
name: "Add borders"
},
{
src: "UsageInstructions/MergeCells.htm",
name: "Merge cells"
},
{
src: "UsageInstructions/ClearFormatting.htm",
name: "Clear text, format in a cell"
},
{
src: "UsageInstructions/SortData.htm",
name: "Sort data"
},
{
src: "UsageInstructions/InsertFunction.htm",
name: "Insert function"
},
{
src: "UsageInstructions/ChangeNumberFormat.htm",
name: "Change number format"
},
{
src: "UsageInstructions/UndoRedo.htm",
name: "Undo/redo your actions"
},
{
src: "UsageInstructions/ViewDocInfo.htm",
name: "View file information"
},
{
src: "UsageInstructions/SavePrintDownload.htm",
name: "Save/print/download your spreadsheet"
},
{
src: "HelpfulHints/About.htm",
name: "About ONLYOFFICE Spreadsheet Editor",
headername: "Helpful Hints"
},
{
src: "HelpfulHints/SupportedFormats.htm",
name: "Supported Formats of Spreadsheets"
},
{
src: "HelpfulHints/Navigation.htm",
name: "Navigation through Your Spreadsheet"
},
{
src: "HelpfulHints/Search.htm",
name: "Search Function"
},
{
src: "HelpfulHints/KeyboardShortcuts.htm",
name: "Keyboard Shortcuts"
}];
this.menuStore = Ext.create("Ext.data.Store", {
model: "SSE.model.ModelHelpMenu",
proxy: {
type: "ajax",
url: "help/Contents.json",
noCache: false
},
listeners: {
load: function (store, records, successful) {
if (!successful) {
if (me.urlPref.indexOf("resources/help/en/") < 0) {
me.urlPref = "resources/help/en/";
store.getProxy().url = "resources/help/en/Contents.json";
store.load();
} else {
me.urlPref = "resources/help/en/";
store.loadData(en_data);
}
}
}
}
});
var menuTpl = new Ext.XTemplate('<tpl for=".">', '<tpl if="headername">', '<div class="header-wrap">', '<span class="header">{headername}</span>', "</div>", "</tpl>", '<div class="thumb-wrap">', '<span class="caption">{name}</span>', "</div>", "</tpl>", '<div class="x-clear"></div>');
this.cntMenu = Ext.create("Ext.container.Container", {
layout: "fit",
cls: "help-menu-container",
width: 200,
items: [this.menuView = Ext.create("Ext.view.View", {
store: this.menuStore,
tpl: menuTpl,
singleSelect: true,
trackOver: true,
style: "overflow:visible;",
width: "100%",
overItemCls: "x-item-over",
itemSelector: "div.thumb-wrap",
cls: "help-menu-view",
listeners: {
afterrender: function (view) {
view.getSelectionModel().deselectOnContainerClick = false;
if (view.getStore().getCount()) {
view.select(0);
me.iFrame.src = me.urlPref + view.getStore().getAt(0).data.src;
}
},
selectionchange: function (model, selections) {
var record = model.getLastSelected();
if (record) {
me.iFrame.src = me.urlPref + record.data.src;
}
}
},
plugins: [{
ptype: "dataviewscrollpane",
areaSelector: ".help-menu-view",
pluginId: "docHelpPluginId",
settings: {
enableKeyboardNavigation: true,
keyboardSpeed: 0.001
}
}]
})]
});
this.iFrame = document.createElement("iframe");
this.iFrame.src = "";
this.iFrame.align = "top";
this.iFrame.frameBorder = "0";
this.iFrame.width = "100%";
this.iFrame.height = "100%";
this.iFrame.onload = Ext.bind(function () {
var src = arguments[0].currentTarget.contentDocument.URL;
Ext.each(this.menuStore.data.items, function (item, index) {
var res = src.indexOf(item.data.src);
if (res > 0) {
this.menuView.select(index);
var node = this.menuView.getNode(index),
plugin = this.menuView.getPlugin("docHelpPluginId");
if (plugin) {
plugin.scrollToElement(node);
}
return false;
}
},
this);
},
this);
this.items = [{
xtype: "container",
layout: {
type: "hbox",
align: "stretch"
},
height: "100%",
items: [this.cntMenu, {
xtype: "tbspacer",
width: 2,
style: "border-left: 1px solid #C7C7C7"
},
{
xtype: "container",
flex: 1,
layout: "fit",
listeners: {
afterrender: function (cmp) {
cmp.getEl().appendChild(me.iFrame);
}
}
}]
}];
this.callParent(arguments);
},
setApi: function (o) {
if (o) {
this.api = o;
}
},
setLangConfig: function (lang) {
if (lang) {
lang = lang.split("-")[0];
this.menuStore.getProxy().url = "resources/help/" + lang + "/Contents.json";
this.menuStore.load();
this.urlPref = "resources/help/" + lang + "/";
}
}
});

View File

@@ -1,399 +1,416 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.DocumentHolder", {
extend: "Ext.container.Container",
alias: "widget.ssedocumentholder",
cls: "sse-documentholder",
uses: ["Ext.menu.Menu", "Ext.menu.Manager", "SSE.view.FormulaDialog", "Common.plugin.MenuExpand"],
config: {},
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
layout: "fit",
initComponent: function () {
var me = this;
this.setApi = function (o) {
me.api = o;
return me;
};
var value = window.localStorage.getItem("sse-settings-livecomment");
me.isLiveCommenting = !(value !== null && parseInt(value) == 0);
me.addEvents("editcomplete");
me.callParent(arguments);
},
createDelayedElements: function () {
var me = this;
function fixSubmenuPosition(submenu) {
if (!submenu.getPosition()[0]) {
if (submenu.floatParent) {
var xy = submenu.el.getAlignToXY(submenu.parentItem.getEl(), "tl-tr?"),
region = submenu.floatParent.getTargetEl().getViewRegion();
submenu.setPosition([xy[0] - region.x, xy[1] - region.y]);
}
}
}
this.pmiInsertEntire = Ext.widget("menuitem", {
action: "insert-entire",
text: me.txtInsert
});
this.pmiInsertCells = Ext.widget("menuitem", {
text: me.txtInsert,
hideOnClick: false,
menu: {
action: "insert-cells",
showSeparator: false,
bodyCls: "no-icons",
items: [{
text: me.txtShiftRight,
kind: c_oAscInsertOptions.InsertCellsAndShiftRight
},
{
text: me.txtShiftDown,
kind: c_oAscInsertOptions.InsertCellsAndShiftDown
},
{
text: me.txtRow,
kind: c_oAscInsertOptions.InsertRows
},
{
text: me.txtColumn,
kind: c_oAscInsertOptions.InsertColumns
}],
plugins: [{
ptype: "menuexpand"
}],
listeners: {
show: fixSubmenuPosition
}
}
});
this.pmiDeleteEntire = Ext.widget("menuitem", {
action: "delete-entire",
text: me.txtDelete
});
this.pmiDeleteCells = Ext.widget("menuitem", {
text: me.txtDelete,
hideOnClick: false,
menu: {
action: "delete-cells",
showSeparator: false,
bodyCls: "no-icons",
items: [{
text: me.txtShiftLeft,
kind: c_oAscDeleteOptions.DeleteCellsAndShiftLeft
},
{
text: me.txtShiftUp,
kind: c_oAscDeleteOptions.DeleteCellsAndShiftTop
},
{
text: me.txtRow,
kind: c_oAscDeleteOptions.DeleteRows
},
{
text: me.txtColumn,
kind: c_oAscDeleteOptions.DeleteColumns
}],
plugins: [{
ptype: "menuexpand"
}],
listeners: {
show: fixSubmenuPosition
}
}
});
this.pmiSortCells = Ext.widget("menuitem", {
text: me.txtSort,
hideOnClick: false,
menu: {
id: "cmi-sort-cells",
bodyCls: "no-icons",
showSeparator: false,
items: [{
text: me.txtAscending,
direction: "descending"
},
{
text: me.txtDescending,
direction: "ascending"
}],
plugins: [{
ptype: "menuexpand"
}],
listeners: {
show: fixSubmenuPosition
}
}
});
this.pmiInsFunction = Ext.widget("menuitem", {
text: me.txtFormula,
listeners: {
click: function (item) {
dlgFormulas.addListener("onmodalresult", function (o, mr, s) {
me.fireEvent("editcomplete", me);
},
me, {
single: true
});
dlgFormulas.show();
}
}
});
this.pmiInsHyperlink = Ext.widget("menuitem", {
action: "insert-hyperlink",
text: me.txtInsHyperlink
});
this.pmiDelHyperlink = Ext.widget("menuitem", {
action: "remove-hyperlink",
text: me.removeHyperlinkText
});
this.pmiRowHeight = Ext.widget("menuitem", {
action: "row-height",
text: this.txtRowHeight
});
this.pmiColumnWidth = Ext.widget("menuitem", {
action: "column-width",
text: this.txtColumnWidth
});
this.pmiEntireHide = Ext.widget("menuitem", {
text: this.txtHide,
handler: function (item, event) {
me.api[item.isrowmenu ? "asc_hideRows" : "asc_hideColumns"]();
}
});
this.pmiEntireShow = Ext.widget("menuitem", {
text: this.txtShow,
handler: function (item, event) {
me.api[item.isrowmenu ? "asc_showRows" : "asc_showColumns"]();
}
});
this.pmiAddComment = Ext.widget("menuitem", {
id: "cmi-add-comment",
text: this.txtAddComment
});
this.pmiCellMenuSeparator = Ext.widget("menuseparator");
this.ssMenu = Ext.widget("menu", {
id: "context-menu-cell",
showSeparator: false,
bodyCls: "no-icons",
group: "menu-document",
items: [{
text: this.txtCut,
group: "copy-paste",
action: "cut"
},
{
text: this.txtCopy,
group: "copy-paste",
action: "copy"
},
{
text: this.txtPaste,
group: "copy-paste",
action: "paste"
},
{
xtype: "menuseparator"
},
this.pmiInsertEntire, this.pmiInsertCells, this.pmiDeleteEntire, this.pmiDeleteCells, {
action: "clear-all",
text: me.txtClear
},
this.pmiSortCells, {
xtype: "menuseparator"
},
this.pmiAddComment, this.pmiCellMenuSeparator, this.pmiInsFunction, this.pmiInsHyperlink, this.pmiDelHyperlink, this.pmiRowHeight, this.pmiColumnWidth, this.pmiEntireHide, this.pmiEntireShow],
plugins: [{
ptype: "menuexpand"
}]
});
this.mnuGroupImg = Ext.create("Ext.menu.Item", {
iconCls: "mnu-icon-item mnu-group",
text: this.txtGroup,
action: "image-grouping",
grouping: true
});
this.mnuUnGroupImg = Ext.create("Ext.menu.Item", {
iconCls: "mnu-icon-item mnu-ungroup",
text: this.txtUngroup,
action: "image-grouping",
grouping: false
});
this.imgMenu = Ext.widget("menu", {
showSeparator: false,
group: "menu-document",
listeners: {
click: function (menu, item) {
if (item) {
me.api.asc_setSelectedDrawingObjectLayer(item.arrange);
}
me.fireEvent("editcomplete", me);
}
},
items: [{
iconCls: "mnu-icon-item mnu-arrange-front",
text: this.textArrangeFront,
arrange: c_oAscDrawingLayerType.BringToFront
},
{
iconCls: "mnu-icon-item mnu-arrange-back",
text: this.textArrangeBack,
arrange: c_oAscDrawingLayerType.SendToBack
},
{
iconCls: "mnu-icon-item mnu-arrange-forward",
text: this.textArrangeForward,
arrange: c_oAscDrawingLayerType.BringForward
},
{
iconCls: "mnu-icon-item mnu-arrange-backward",
text: this.textArrangeBackward,
arrange: c_oAscDrawingLayerType.SendBackward
},
{
xtype: "menuseparator"
},
this.mnuGroupImg, this.mnuUnGroupImg]
});
this.menuParagraphVAlign = Ext.widget("menuitem", {
text: this.vertAlignText,
hideOnClick: false,
menu: {
showSeparator: false,
bodyCls: "no-icons",
items: [this.menuParagraphTop = Ext.widget("menucheckitem", {
text: this.topCellText,
checked: false,
group: "popupparagraphvalign",
valign: c_oAscVerticalTextAlign.TEXT_ALIGN_TOP
}), this.menuParagraphCenter = Ext.widget("menucheckitem", {
text: this.centerCellText,
checked: false,
group: "popupparagraphvalign",
valign: c_oAscVerticalTextAlign.TEXT_ALIGN_CTR
}), this.menuParagraphBottom = Ext.widget("menucheckitem", {
text: this.bottomCellText,
checked: false,
group: "popupparagraphvalign",
valign: c_oAscVerticalTextAlign.TEXT_ALIGN_BOTTOM
})],
plugins: [{
ptype: "menuexpand"
}]
}
});
this.pmiInsHyperlinkShape = Ext.widget("menuitem", {
text: me.txtInsHyperlink,
action: "add-hyperlink-shape"
});
this.pmiRemoveHyperlinkShape = Ext.widget("menuitem", {
text: me.removeHyperlinkText,
action: "remove-hyperlink-shape"
});
this.pmiTextAdvanced = Ext.widget("menuitem", {
text: me.txtTextAdvanced,
action: "text-advanced"
});
this.textInShapeMenu = Ext.widget("menu", {
showSeparator: false,
bodyCls: "no-icons",
group: "menu-document",
items: [this.menuParagraphVAlign, this.pmiInsHyperlinkShape, this.pmiRemoveHyperlinkShape, {
xtype: "menuseparator"
},
this.pmiTextAdvanced]
});
this.funcMenu = Ext.widget("menu", {
showSeparator: false,
bodyCls: "no-icons",
group: "menu-document",
items: [{
text: "item 1"
},
{
text: "item 2"
},
{
text: "item 3"
},
{
text: "item 4"
},
{
text: "item 5"
}]
});
},
setLiveCommenting: function (value) {
this.isLiveCommenting = value;
},
txtSort: "Sort",
txtAscending: "Ascending",
txtDescending: "Descending",
txtFormula: "Insert Function",
txtInsHyperlink: "Add Hyperlink",
txtCut: "Cut",
txtCopy: "Copy",
txtPaste: "Paste",
txtInsert: "Insert",
txtDelete: "Delete",
txtFilter: "Filter",
txtClear: "Clear All",
txtShiftRight: "Shift cells right",
txtShiftLeft: "Shift cells left",
txtShiftUp: "Shift cells up",
txtShiftDown: "Shift cells down",
txtRow: "Entire Row",
txtColumn: "Entire Column",
txtColumnWidth: "Column Width",
txtRowHeight: "Row Height",
txtWidth: "Width",
txtHide: "Hide",
txtShow: "Show",
textArrangeFront: "Bring To Front",
textArrangeBack: "Send To Back",
textArrangeForward: "Bring Forward",
textArrangeBackward: "Send Backward",
txtArrange: "Arrange",
txtAddComment: "Add Comment",
txtUngroup: "Ungroup",
txtGroup: "Group",
topCellText: "Align Top",
centerCellText: "Align Center",
bottomCellText: "Align Bottom",
vertAlignText: "Vertical Alignment",
txtTextAdvanced: "Text Advanced Settings",
editHyperlinkText: "Edit Hyperlink",
removeHyperlinkText: "Remove Hyperlink"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["jquery", "underscore", "backbone", "gateway", "common/main/lib/component/Menu"], function ($, _, Backbone, gateway) {
SSE.Views.DocumentHolder = Backbone.View.extend(_.extend({
el: "#editor_sdk",
template: null,
events: {},
initialize: function () {
var me = this;
this.setApi = function (api) {
me.api = api;
return me;
};
var value = window.localStorage.getItem("sse-settings-livecomment");
me.isLiveCommenting = !(value !== null && parseInt(value) == 0);
},
render: function () {
this.fireEvent("render:before", this);
this.cmpEl = $(this.el);
this.fireEvent("render:after", this);
return this;
},
focus: function () {
var me = this;
_.defer(function () {
me.cmpEl.focus();
},
50);
},
createDelayedElements: function () {
var me = this;
me.pmiCut = new Common.UI.MenuItem({
caption: me.txtCut,
value: "cut"
});
me.pmiCopy = new Common.UI.MenuItem({
caption: me.txtCopy,
value: "copy"
});
me.pmiPaste = new Common.UI.MenuItem({
caption: me.txtPaste,
value: "paste"
});
me.pmiInsertEntire = new Common.UI.MenuItem({
caption: me.txtInsert
});
me.pmiInsertCells = new Common.UI.MenuItem({
caption: me.txtInsert,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: me.txtShiftRight,
value: c_oAscInsertOptions.InsertCellsAndShiftRight
},
{
caption: me.txtShiftDown,
value: c_oAscInsertOptions.InsertCellsAndShiftDown
},
{
caption: me.txtRow,
value: c_oAscInsertOptions.InsertRows
},
{
caption: me.txtColumn,
value: c_oAscInsertOptions.InsertColumns
}]
})
});
me.pmiDeleteEntire = new Common.UI.MenuItem({
caption: me.txtDelete
});
me.pmiDeleteCells = new Common.UI.MenuItem({
caption: me.txtDelete,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: me.txtShiftLeft,
value: c_oAscDeleteOptions.DeleteCellsAndShiftLeft
},
{
caption: me.txtShiftUp,
value: c_oAscDeleteOptions.DeleteCellsAndShiftTop
},
{
caption: me.txtRow,
value: c_oAscDeleteOptions.DeleteRows
},
{
caption: me.txtColumn,
value: c_oAscDeleteOptions.DeleteColumns
}]
})
});
me.pmiClear = new Common.UI.MenuItem({
caption: me.txtClear,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: me.txtClearAll,
value: c_oAscCleanOptions.All
},
{
caption: me.txtClearText,
value: c_oAscCleanOptions.Text
},
{
caption: me.txtClearFormat,
value: c_oAscCleanOptions.Format
},
{
caption: me.txtClearComments,
value: c_oAscCleanOptions.Comments
},
{
caption: me.txtClearHyper,
value: c_oAscCleanOptions.Hyperlinks
}]
})
});
me.pmiSortCells = new Common.UI.MenuItem({
caption: me.txtSort,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [{
caption: me.txtAscending,
value: "ascending"
},
{
caption: me.txtDescending,
value: "descending"
}]
})
});
me.pmiInsFunction = new Common.UI.MenuItem({
caption: me.txtFormula
});
me.menuAddHyperlink = new Common.UI.MenuItem({
caption: me.txtInsHyperlink,
inCell: true
});
me.menuEditHyperlink = new Common.UI.MenuItem({
caption: me.editHyperlinkText,
inCell: true
});
me.menuRemoveHyperlink = new Common.UI.MenuItem({
caption: me.removeHyperlinkText
});
me.menuHyperlink = new Common.UI.MenuItem({
caption: me.txtInsHyperlink,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [me.menuEditHyperlink, me.menuRemoveHyperlink]
})
});
me.pmiRowHeight = new Common.UI.MenuItem({
caption: me.txtRowHeight,
action: "row-height"
});
me.pmiColumnWidth = new Common.UI.MenuItem({
caption: me.txtColumnWidth,
action: "column-width"
});
me.pmiEntireHide = new Common.UI.MenuItem({
caption: me.txtHide
});
me.pmiEntireShow = new Common.UI.MenuItem({
caption: me.txtShow
});
me.pmiAddComment = new Common.UI.MenuItem({
id: "id-context-menu-item-add-comment",
caption: me.txtAddComment
});
me.pmiCellMenuSeparator = new Common.UI.MenuItem({
caption: "--"
});
me.ssMenu = new Common.UI.Menu({
id: "id-context-menu-cell",
items: [me.pmiCut, me.pmiCopy, me.pmiPaste, {
caption: "--"
},
me.pmiInsertEntire, me.pmiInsertCells, me.pmiDeleteEntire, me.pmiDeleteCells, me.pmiClear, me.pmiSortCells, {
caption: "--"
},
me.pmiAddComment, me.pmiCellMenuSeparator, me.pmiInsFunction, me.menuAddHyperlink, me.menuHyperlink, me.pmiRowHeight, me.pmiColumnWidth, me.pmiEntireHide, me.pmiEntireShow]
});
me.mnuGroupImg = new Common.UI.MenuItem({
caption: this.txtGroup,
iconCls: "mnu-group",
type: "group",
value: "grouping"
});
me.mnuUnGroupImg = new Common.UI.MenuItem({
caption: this.txtUngroup,
iconCls: "mnu-ungroup",
type: "group",
value: "ungrouping"
});
me.mnuShapeSeparator = new Common.UI.MenuItem({
caption: "--"
});
me.mnuShapeAdvanced = new Common.UI.MenuItem({
caption: me.advancedShapeText
});
me.mnuChartEdit = new Common.UI.MenuItem({
caption: me.chartText
});
me.pmiImgCut = new Common.UI.MenuItem({
caption: me.txtCut,
value: "cut"
});
me.pmiImgCopy = new Common.UI.MenuItem({
caption: me.txtCopy,
value: "copy"
});
me.pmiImgPaste = new Common.UI.MenuItem({
caption: me.txtPaste,
value: "paste"
});
this.imgMenu = new Common.UI.Menu({
items: [me.pmiImgCut, me.pmiImgCopy, me.pmiImgPaste, {
caption: "--"
},
{
caption: this.textArrangeFront,
iconCls: "mnu-arrange-front",
type: "arrange",
value: c_oAscDrawingLayerType.BringToFront
},
{
caption: this.textArrangeBack,
iconCls: "mnu-arrange-back",
type: "arrange",
value: c_oAscDrawingLayerType.SendToBack
},
{
caption: this.textArrangeForward,
iconCls: "mnu-arrange-forward",
type: "arrange",
value: c_oAscDrawingLayerType.BringForward
},
{
caption: this.textArrangeBackward,
iconCls: "mnu-arrange-backward",
type: "arrange",
value: c_oAscDrawingLayerType.SendBackward
},
{
caption: "--"
},
me.mnuGroupImg, me.mnuUnGroupImg, me.mnuShapeSeparator, me.mnuChartEdit, me.mnuShapeAdvanced]
});
this.menuParagraphVAlign = new Common.UI.MenuItem({
caption: this.vertAlignText,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [me.menuParagraphTop = new Common.UI.MenuItem({
caption: me.topCellText,
checkable: true,
toggleGroup: "popupparagraphvalign",
value: c_oAscVerticalTextAlign.TEXT_ALIGN_TOP
}), me.menuParagraphCenter = new Common.UI.MenuItem({
caption: me.centerCellText,
checkable: true,
toggleGroup: "popupparagraphvalign",
value: c_oAscVerticalTextAlign.TEXT_ALIGN_CTR
}), this.menuParagraphBottom = new Common.UI.MenuItem({
caption: me.bottomCellText,
checkable: true,
toggleGroup: "popupparagraphvalign",
value: c_oAscVerticalTextAlign.TEXT_ALIGN_BOTTOM
})]
})
});
me.menuAddHyperlinkShape = new Common.UI.MenuItem({
caption: me.txtInsHyperlink
});
me.menuEditHyperlinkShape = new Common.UI.MenuItem({
caption: me.editHyperlinkText
});
me.menuRemoveHyperlinkShape = new Common.UI.MenuItem({
caption: me.removeHyperlinkText
});
me.menuHyperlinkShape = new Common.UI.MenuItem({
caption: me.txtInsHyperlink,
menu: new Common.UI.Menu({
menuAlign: "tl-tr",
items: [me.menuEditHyperlinkShape, me.menuRemoveHyperlinkShape]
})
});
this.pmiTextAdvanced = new Common.UI.MenuItem({
caption: me.txtTextAdvanced
});
me.pmiTextCut = new Common.UI.MenuItem({
caption: me.txtCut,
value: "cut"
});
me.pmiTextCopy = new Common.UI.MenuItem({
caption: me.txtCopy,
value: "copy"
});
me.pmiTextPaste = new Common.UI.MenuItem({
caption: me.txtPaste,
value: "paste"
});
this.textInShapeMenu = new Common.UI.Menu({
items: [me.pmiTextCut, me.pmiTextCopy, me.pmiTextPaste, {
caption: "--"
},
me.menuParagraphVAlign, me.menuAddHyperlinkShape, me.menuHyperlinkShape, {
caption: "--"
},
me.pmiTextAdvanced]
});
this.funcMenu = new Common.UI.Menu({
items: [{
caption: "item 1"
},
{
caption: "item 2"
},
{
caption: "item 3"
},
{
caption: "item 4"
},
{
caption: "item 5"
}]
});
me.fireEvent("createdelayedelements", [me]);
},
setMenuItemCommentCaptionMode: function (edit) {
edit ? this.pmiAddComment.setCaption(this.txtEditComment) : this.pmiAddComment.setCaption(this.txtAddComment);
},
setLiveCommenting: function (value) {
this.isLiveCommenting = value;
},
txtSort: "Sort",
txtAscending: "Ascending",
txtDescending: "Descending",
txtFormula: "Insert Function",
txtInsHyperlink: "Hyperlink",
txtCut: "Cut",
txtCopy: "Copy",
txtPaste: "Paste",
txtInsert: "Insert",
txtDelete: "Delete",
txtClear: "Clear",
txtClearAll: "All",
txtClearText: "Text",
txtClearFormat: "Format",
txtClearHyper: "Hyperlink",
txtClearComments: "Comments",
txtShiftRight: "Shift cells right",
txtShiftLeft: "Shift cells left",
txtShiftUp: "Shift cells up",
txtShiftDown: "Shift cells down",
txtRow: "Entire Row",
txtColumn: "Entire Column",
txtColumnWidth: "Column Width",
txtRowHeight: "Row Height",
txtWidth: "Width",
txtHide: "Hide",
txtShow: "Show",
textArrangeFront: "Bring To Front",
textArrangeBack: "Send To Back",
textArrangeForward: "Bring Forward",
textArrangeBackward: "Send Backward",
txtArrange: "Arrange",
txtAddComment: "Add Comment",
txtEditComment: "Edit Comment",
txtUngroup: "Ungroup",
txtGroup: "Group",
topCellText: "Align Top",
centerCellText: "Align Center",
bottomCellText: "Align Bottom",
vertAlignText: "Vertical Alignment",
txtTextAdvanced: "Text Advanced Settings",
editHyperlinkText: "Edit Hyperlink",
removeHyperlinkText: "Remove Hyperlink",
editChartText: "Edit Data",
advancedShapeText: "Shape Advanced Settings",
chartText: "Chart Advanced Settings"
},
SSE.Views.DocumentHolder || {}));
});

View File

@@ -1,250 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.DocumentInfo", {
extend: "Ext.container.Container",
alias: "widget.ssedocumentinfo",
cls: "sse-documentinfo-body",
autoScroll: true,
requires: ["Ext.button.Button", "Ext.container.Container", "Common.plugin.ScrollPane", "Ext.form.Label", "Ext.XTemplate", "Ext.Date"],
uses: ["Common.view.DocumentAccessDialog"],
listeners: {
afterrender: function (cmp, eOpts) {
cmp.updateInfo(cmp.doc);
}
},
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
this.infoObj = {
PageCount: 0,
WordsCount: 0,
ParagraphCount: 0,
SymbolsCount: 0,
SymbolsWSCount: 0
};
this.inProgress = false;
this.lblTitle = Ext.create("Ext.form.Label", {
text: "-",
height: 14
});
this.lblPlacement = Ext.create("Ext.form.Label", {
text: "-",
width: 150,
height: 14,
style: "text-align:left",
hideId: "element-to-hide"
});
this.lblDate = Ext.create("Ext.form.Label", {
text: "-",
width: 150,
height: 14,
style: "text-align:left",
hideId: "element-to-hide"
});
var userTpl = Ext.create("Ext.XTemplate", '<span class="userLink">{text:htmlEncode}</span>');
this.cntAuthor = Ext.create("Ext.container.Container", {
tpl: userTpl,
data: {
text: "-"
},
hideId: "element-to-hide"
});
var rightsTpl = Ext.create("Ext.XTemplate", "<table>", '<tpl for=".">', "<tr>", '<td style="padding: 0 20px 5px 0;"><span class="userLink">{user:htmlEncode}</span></td>', '<td style="padding: 0 20px 5px 0;">{permissions:htmlEncode}</td>', "</tr>", "</tpl>", "</table>");
this.cntRights = Ext.create("Ext.container.Container", {
tpl: rightsTpl,
hideId: "element-to-hide"
});
this.items = [{
xtype: "tbspacer",
height: 30
},
{
xtype: "container",
layout: {
type: "table",
columns: 2,
tableAttrs: {
style: "width: 100%;"
},
tdAttrs: {
style: "padding: 5px 10px;vertical-align: top;"
}
},
items: [{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.txtTitle,
style: "display: block;text-align: right;",
width: "100%"
},
this.lblTitle, {
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.txtAuthor,
style: "display: block;text-align: right;",
width: "100%"
},
this.cntAuthor, {
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.txtPlacement,
style: "display: block;text-align: right;",
width: "100%"
},
this.lblPlacement, {
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.txtDate,
style: "display: block;text-align: right;",
width: "100%"
},
this.lblDate, {
xtype: "tbspacer",
colspan: 2,
height: 5
},
{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.txtRights,
style: "display: block;text-align: right;",
width: "100%"
},
this.cntRights, this.tbsRights = Ext.create("Ext.toolbar.Spacer", {
colspan: 2,
height: 5,
hideId: "element-to-hide"
}), {
xtype: "box"
},
this.btnEditRights = Ext.widget("button", {
id: "doc-info-set-rights",
cls: "asc-blue-button",
text: this.txtBtnAccessRights,
hideId: "element-to-hide",
listeners: {
click: Ext.bind(this._changeAccessRights, this)
}
})]
}];
Ext.apply(this, {
plugins: [{
ptype: "scrollpane",
areaSelector: ".x-container",
pluginId: "docInfoPluginId",
settings: {
enableKeyboardNavigation: true
}
}]
});
this.callParent(arguments);
},
updateInfo: function (doc) {
this.doc = doc;
if (!this.rendered) {
return;
}
doc = doc || {};
this.lblTitle.setText((doc.title) ? doc.title : "-");
if (doc.info) {
if (doc.info.author) {
this.cntAuthor.update({
text: doc.info.author
});
}
this._ShowHideInfoItem(this.cntAuthor, doc.info.author !== undefined && doc.info.author !== null);
if (doc.info.created) {
this.lblDate.setText(doc.info.created);
}
this._ShowHideInfoItem(this.lblDate, doc.info.created !== undefined && doc.info.created !== null);
if (doc.info.folder) {
this.lblPlacement.setText(doc.info.folder);
}
this._ShowHideInfoItem(this.lblPlacement, doc.info.folder !== undefined && doc.info.folder !== null);
if (doc.info.sharingSettings) {
this.cntRights.update(doc.info.sharingSettings);
}
this._ShowHideInfoItem(this.cntRights, doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
this._ShowHideInfoItem(this.tbsRights, doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
this._ShowHideInfoItem(this.btnEditRights, !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights !== true);
} else {
this._ShowHideDocInfo(false);
}
},
_ShowHideInfoItem: function (cmp, visible) {
var tr = cmp.getEl().up("tr");
if (tr) {
tr.setDisplayed(visible);
}
},
_ShowHideDocInfo: function (visible) {
var components = Ext.ComponentQuery.query('[hideId="element-to-hide"]', this);
for (var i = 0; i < components.length; i++) {
this._ShowHideInfoItem(components[i], visible);
}
},
stopUpdatingStatisticInfo: function () {},
setApi: function (o) {},
loadConfig: function (data) {
this.sharingSettingsUrl = data.config.sharingSettingsUrl;
return this;
},
_changeAccessRights: function (btn, event, opts) {
var win = Ext.widget("commondocumentaccessdialog", {
settingsurl: this.sharingSettingsUrl
});
var me = this;
win.on("accessrights", function (obj, rights) {
me.doc.info.sharingSettings = rights;
me.cntRights.update(rights);
});
win.show();
},
onLostEditRights: function () {
this._readonlyRights = true;
if (!this.rendered) {
return;
}
this._ShowHideInfoItem(this.cntRights, false);
this._ShowHideInfoItem(this.tbsRights, false);
this._ShowHideInfoItem(this.btnEditRights, false);
},
txtTitle: "Document Title",
txtAuthor: "Author",
txtPlacement: "Placement",
txtDate: "Creation Date",
txtRights: "Persons who have rights",
txtBtnAccessRights: "Change access rights"
});

View File

@@ -1,161 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.DocumentSettings", {
extend: "Ext.container.Container",
alias: "widget.ssedocumentsettings",
cls: "sse-documentsettings-panel",
autoScroll: true,
requires: ["Ext.container.Container", "Ext.XTemplate", "Ext.view.View", "Ext.data.Model", "Ext.data.Store", "Common.plugin.DataViewScrollPane", "SSE.view.MainSettingsGeneral", "SSE.view.MainSettingsPrint"],
listeners: {
show: function (cmp, eOpts) {
cmp.updateSettings();
}
},
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
var me = this;
me.addEvents("savedocsettings");
this.addEvents("changemeasureunit");
me.generalSettings = Ext.widget("ssemainsettingsgeneral");
me.printSettings = Ext.widget("ssemainsettingsprint");
me.printSettings.updateMetricUnit();
var settingsPanels = [me.generalSettings, me.printSettings, 1];
me.generalSettings.addListener("savedocsettings", function () {
me.fireEvent("savedocsettings", me);
});
me.generalSettings.addListener("changemeasureunit", function () {
var value = window.localStorage.getItem("sse-settings-unit");
Common.MetricSettings.setCurrentMetric((value !== null) ? parseInt(value) : Common.MetricSettings.c_MetricUnits.cm);
me.printSettings.updateMetricUnit();
me.fireEvent("changemeasureunit", me);
});
this.menuStore = Ext.create("Ext.data.Store", {
fields: ["name", {
type: "int",
name: "panelindex"
},
"iconCls"],
data: [{
name: me.txtGeneral,
panelindex: 0,
iconCls: "mnu-settings-general"
},
{
name: me.txtPrint,
panelindex: 1,
iconCls: "mnu-print"
}]
});
var menuTpl = new Ext.XTemplate('<tpl for=".">', '<div class="thumb-wrap">', '<img class="icon {iconCls}" src="' + Ext.BLANK_IMAGE_URL + '" />', '<span class="caption">{name}</span>', "</div>", "</tpl>", '<div class="x-clear"></div>');
this.cntMenu = Ext.create("Ext.container.Container", {
layout: "fit",
cls: "help-menu-container",
width: 200,
items: [this.menuView = Ext.create("Ext.view.View", {
store: this.menuStore,
tpl: menuTpl,
singleSelect: true,
trackOver: true,
style: "overflow:visible;",
width: "100%",
overItemCls: "x-item-over",
itemSelector: "div.thumb-wrap",
cls: "help-menu-view",
listeners: {
afterrender: function (view) {
view.getSelectionModel().deselectOnContainerClick = false;
view.select(0);
},
selectionchange: function (model, selections) {
var record = model.getLastSelected();
if (record) {
if (settingsPanels[record.data.panelindex].updateSettings) {
settingsPanels[record.data.panelindex].updateSettings();
}
settingsPanels[record.data.panelindex].setVisible(true);
settingsPanels[settingsPanels[settingsPanels.length - 1]].setVisible(false);
settingsPanels[settingsPanels.length - 1] = record.data.panelindex;
}
}
},
plugins: [{
ptype: "dataviewscrollpane",
areaSelector: ".help-menu-view",
pluginId: "docHelpPluginId",
settings: {
enableKeyboardNavigation: true,
keyboardSpeed: 0.001
}
}]
})]
});
this.items = [{
xtype: "container",
layout: {
type: "hbox",
align: "stretch"
},
height: "100%",
items: [this.cntMenu, {
xtype: "tbspacer",
width: 2,
style: "border-left: 1px solid #C7C7C7"
},
{
xtype: "container",
flex: 1,
layout: "fit",
items: [me.generalSettings, me.printSettings],
listeners: {}
}]
}];
this.callParent(arguments);
},
setApi: function (o) {
if (o) {
this.api = o;
}
},
updateSettings: function () {
this.generalSettings && this.generalSettings.updateSettings();
},
setMode: function (mode) {
this.mode = mode;
this.generalSettings && this.generalSettings.setMode(this.mode);
},
txtGeneral: "General",
txtPrint: "Print"
});

View File

@@ -1,711 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var ACTIVE_TAB_NEXT = -255;
var ACTIVE_TAB_PREV = -254;
Ext.define("SSE.view.DocumentStatusInfo", {
extend: "Ext.container.Container",
alias: "widget.documentstatusinfo",
requires: ["Ext.form.field.Number", "Ext.button.Button", "Ext.form.Label", "Ext.toolbar.Spacer", "SSE.plugin.TabBarScroller", "SSE.plugin.TabReorderer"],
uses: ["Ext.tip.ToolTip", "Ext.menu.Menu", "SSE.view.SheetRenameDialog", "SSE.view.SheetCopyDialog", "Common.view.Participants"],
cls: "sse-documentstatusinfo",
height: 27,
layout: {
type: "hbox",
align: "middle"
},
style: "padding-left:5px;padding-right:40px;",
initComponent: function () {
var me = this;
this.permissions = {};
this.txtZoom = Ext.widget("label", {
id: "status-label-zoom",
text: Ext.String.format(me.zoomText, 0),
cls: "statusinfo-pages",
style: "cursor: pointer; white-space:nowrap; text-align: center;",
listeners: {
afterrender: function (ct) {
ct.getEl().on("mousedown", onShowZoomMenu, me);
ct.getEl().set({
"data-qtip": me.tipZoomFactor,
"data-qalign": "bl-tl?"
});
ct.setWidth(Ext.util.TextMetrics.measure(ct.getEl(), Ext.String.format(me.zoomText, 999)).width);
}
}
});
this.btnZoomIn = Ext.widget("button", {
id: "status-button-zoom-in",
cls: "asc-btn-zoom asc-statusbar-icon-btn",
iconCls: "asc-statusbar-btn btn-zoomin",
style: "margin-left:5px;"
});
this.btnZoomOut = Ext.widget("button", {
id: "status-button-zoom-out",
cls: "asc-btn-zoom asc-statusbar-icon-btn",
iconCls: "asc-statusbar-btn btn-zoomout",
style: "margin:0 5px 0 40px;"
});
this.userPanel = Ext.widget("statusinfoparticipants", {
pack: "end",
userIconCls: "sse-icon-statusinfo-users"
});
var onShowZoomMenu = function (event, elem) {
if (!elem.disabled) {
this.menuZoomTo.show();
this.menuZoomTo.showBy(me.txtZoom, "b-t", [0, -10]);
}
};
this.setApi = function (o) {
this.api = o;
this.api.asc_registerCallback("asc_onZoomChanged", Ext.bind(me.onZoomChange, me));
this.api.asc_registerCallback("asc_onSheetsChanged", Ext.bind(me.updateInfo, me));
this.api.asc_registerCallback("asc_onEditCell", Ext.bind(me._onStartEditCell, me));
this.api.asc_registerCallback("asc_onActiveSheetChanged", Ext.bind(me._onActiveSheetChanged, me));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(me.onCoAuthoringDisconnect, me));
this.api.asc_registerCallback("asc_onWorkbookLocked", Ext.bind(me.onWorkbookLocked, me));
this.api.asc_registerCallback("asc_onWorksheetLocked", Ext.bind(me.onWorksheetLocked, me));
this.userPanel.setApi(this.api);
return this;
};
var btnPageFirst = Ext.widget("button", {
cls: "asc-btn-zoom asc-statusbar-icon-btn",
iconCls: "asc-page-scroller-btn btn-scroll-first"
});
var btnPageLast = Ext.widget("button", {
cls: "asc-btn-zoom asc-statusbar-icon-btn",
iconCls: "asc-page-scroller-btn btn-scroll-last"
});
var btnPagePrev = Ext.widget("button", {
cls: "asc-btn-zoom asc-statusbar-icon-btn",
iconCls: "asc-page-scroller-btn btn-scroll-prev"
});
var btnPageNext = Ext.widget("button", {
cls: "asc-btn-zoom asc-statusbar-icon-btn",
iconCls: "asc-page-scroller-btn btn-scroll-next"
});
this.barWorksheets = Ext.widget("tabbar", {
dock: "bottom",
plain: true,
width: "100%",
style: "margin:-2px 0 0 5px;",
plugins: [{
ptype: "tabbarscroller",
pluginId: "tabbarscroller",
firstButton: btnPageFirst,
lastButton: btnPageLast,
prevButton: btnPagePrev,
nextButton: btnPageNext
},
{
ptype: "tabreorderer",
pluginId: "scheetreorderer"
}]
});
me.items = [btnPageFirst, btnPagePrev, btnPageNext, btnPageLast, {
xtype: "container",
flex: 1,
height: "100%",
items: [this.barWorksheets]
},
this.userPanel, this.btnZoomOut, this.txtZoom, this.btnZoomIn];
me.callParent(arguments);
},
onZoomChange: function (zf, type) {
switch (type) {
case 1:
case 2:
case 0:
default:
this.txtZoom.setText(Ext.String.format(this.zoomText, Math.floor((zf + 0.005) * 100)));
}
this.doLayout();
},
updateInfo: function () {
this.fireEvent("updatesheetsinfo", this);
this.barWorksheets.removeAll();
this.ssMenu.items.items[6].menu.removeAll();
this.ssMenu.items.items[6].setVisible(false);
if (this.api) {
var me = this;
var wc = this.api.asc_getWorksheetsCount(),
i = -1;
var hidentems = [],
items = [],
tab,
locked;
var sindex = this.api.asc_getActiveWorksheetIndex();
while (++i < wc) {
locked = me.api.asc_isWorksheetLockedOrDeleted(i);
tab = {
sheetindex: i,
text: me.api.asc_getWorksheetName(i).replace(/\s/g, "&nbsp;"),
reorderable: !locked,
closable: false,
cls: locked ? "coauth-locked" : undefined
};
this.api.asc_isWorksheetHidden(i) ? hidentems.push(tab) : items.push(tab);
if (sindex == i) {
sindex = items.length - 1;
}
}
var checkcount = items.length;
if (this.permissions.isEdit) {
items.push({
iconCls: "asc-add-page-icon",
width: 36,
closable: false,
reorderable: false,
disabled: me.api.asc_isWorkbookLocked(),
listeners: {
afterrender: function (cmp) {
cmp.getEl().on("click", me._onAddTabClick, me, {
preventDefault: true,
tabid: "tab-add-new"
});
}
}
});
}
if (hidentems.length) {
this.ssMenu.items.items[6].setVisible(true);
this.ssMenu.items.items[6].menu.add(hidentems);
}
if (checkcount) {
this.barWorksheets.add(items);
if (! (sindex < 0) && sindex < checkcount) {
this.barWorksheets.suspendEvents();
this.barWorksheets.setActiveTab(this.barWorksheets.items.items[sindex]);
this.barWorksheets.resumeEvents();
}
this.barWorksheets.getPlugin("tabbarscroller").scrollToLast();
this.barWorksheets.getPlugin("scheetreorderer").dd.unlock();
}
this.barWorksheets.enable(true);
this.txtZoom.setText(Ext.String.format(this.zoomText, this.api.asc_getZoom() * 100));
}
},
setMode: function (m) {
this.permissions = m;
this.userPanel.setMode(m);
var plugin = this.barWorksheets.getPlugin("scheetreorderer");
if (plugin) {
plugin.setDisabled(!this.permissions.isEdit);
}
},
setActiveWorksheet: function (index, opt) {
if (!index) {
var new_index = this.barWorksheets.activeTab ? this.barWorksheets.items.items.indexOf(this.barWorksheets.activeTab) : 0;
if (opt == ACTIVE_TAB_NEXT) {
if (! (++new_index < this.barWorksheets.items.items.length - 1)) {
new_index = 0;
}
} else {
if (opt == ACTIVE_TAB_PREV) {
if (--new_index < 0) {
new_index = this.barWorksheets.items.items.length - 2;
}
}
}
this.barWorksheets.setActiveTab(this.barWorksheets.items.items[new_index]);
}
},
_onTabClick: function (tabBar, tab, card, eOpts) {
if (! (tab.sheetindex < 0)) {
this.api.asc_showWorksheet(tab.sheetindex);
if (tab.newindex != undefined) {
var new_index = tab.newindex + 1;
new_index < this.barWorksheets.items.length - 1 ? new_index = this.barWorksheets.items.getAt(new_index).sheetindex : new_index = this.api.asc_getWorksheetsCount();
this.api.asc_moveWorksheet(new_index);
tab.newindex = undefined;
}
}
this.fireEvent("editcomplete", this);
},
_onAddTabClick: function (e, el, opt) {
e.stopEvent();
if (!e.target.parentNode.disabled && this.permissions.isEdit) {
this.api.asc_addWorksheet();
}
},
_onTabContextMenu: function (event, docElement, eOpts) {
if (this.api && this.permissions.isEdit) {
var tab = Ext.getCmp(eOpts.tabid);
if (tab && tab.sheetindex >= 0) {
if (!this.barWorksheets.activeTab || tab.id != this.barWorksheets.activeTab.id) {
this.barWorksheets.setActiveTab(tab);
}
var issheetlocked = this.api.asc_isWorksheetLockedOrDeleted(tab.sheetindex),
isdoclocked = this.api.asc_isWorkbookLocked();
this.ssMenu.items.items[0].setDisabled(isdoclocked);
this.ssMenu.items.items[1].setDisabled(issheetlocked);
this.ssMenu.items.items[2].setDisabled(issheetlocked);
this.ssMenu.items.items[3].setDisabled(issheetlocked);
this.ssMenu.items.items[4].setDisabled(issheetlocked);
this.ssMenu.items.items[5].setDisabled(issheetlocked);
this.ssMenu.items.items[6].setDisabled(isdoclocked);
this.api.asc_closeCellEditor();
this._showPopupMenu(this.ssMenu, {},
event, tab.getEl(), eOpts);
}
}
},
_onTabDblClick: function (event, docElement, eOpts) {
if (this.api && this.permissions.isEdit) {
var tab = Ext.getCmp(eOpts.tabid);
if (tab && tab.sheetindex >= 0) {
if (!this.api.asc_isWorksheetLockedOrDeleted(tab.sheetindex) && this.api.asc_getActiveWorksheetIndex() == tab.sheetindex) {
this._renameWorksheet();
}
}
}
},
_showPopupMenu: function (menu, value, event, docElement, eOpts) {
if (Ext.isDefined(menu)) {
Ext.menu.Manager.hideAll();
var showPoint = event.getXY();
showPoint[1] += 10;
if (Ext.isFunction(menu.initMenu)) {
menu.initMenu(value);
}
menu.show();
menu.showBy(docElement, "bl-tl");
}
},
_getNewSheetName: function (n) {
var nameindex = 1;
var firstname = this.strSheet;
var wc = this.api.asc_getWorksheetsCount(),
i = -1;
var items = [];
while (++i < wc) {
items.push(this.api.asc_getWorksheetName(i));
}
while (true) {
if (Ext.Array.contains(items, firstname + nameindex)) {
nameindex++;
if (nameindex > 100) {
return "";
}
} else {
break;
}
}
return firstname + nameindex;
},
_insertWorksheet: function () {
var name = this._getNewSheetName();
this.api.asc_insertWorksheet(name);
},
_deleteWorksheet: function () {
var me = this;
if (this.barWorksheets.items.items.length == 2) {
Ext.Msg.show({
title: this.textWarning,
msg: this.errorLastSheet,
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OK
});
} else {
Ext.create("Ext.window.MessageBox", {
buttonText: {
ok: "OK",
yes: "Yes",
no: "No",
cancel: me.textCancel
}
}).show({
title: this.textWarning,
msg: this.warnDeleteSheet,
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OKCANCEL,
fn: function (bid) {
if (bid == "ok") {
var index = me.api.asc_getActiveWorksheetIndex();
var uid = me.api.asc_getActiveWorksheetId();
if (!me.api.asc_deleteWorksheet()) {
Ext.Msg.show({
title: me.textError,
msg: me.msgDelSheetError,
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
} else {
me.fireEvent("removeworksheet", index, uid);
}
}
}
});
}
},
_renameWorksheet: function () {
var me = this;
var wc = me.api.asc_getWorksheetsCount(),
items = [],
i = -1;
while (++i < wc) {
items.push(me.api.asc_getWorksheetName(i));
}
var win = Ext.create("SSE.view.SheetRenameDialog", {
title: "Rename",
renameindex: me.api.asc_getActiveWorksheetIndex(),
names: items
});
win.addListener("onmodalresult", function (o, mr, s) {
if (mr) {
me.api.asc_renameWorksheet(s);
me.barWorksheets.activeTab.setText(s.replace(/\s/g, "&nbsp;"));
}
me.fireEvent("editcomplete", me);
},
false);
win.show();
var xy = win.getEl().getAlignToXY(me.barWorksheets.activeTab.getEl(), "bl-tl");
win.showAt(xy[0], xy[1] - 4);
},
_getSheetCopyName: function (n) {
var result = /^(.*)\((\d)\)$/.exec(n);
var nameindex = 2;
var firstname = result ? result[1] : n + " ";
var tn = firstname + "(" + nameindex + ")";
var wc = this.api.asc_getWorksheetsCount(),
i = -1;
var items = [];
while (++i < wc) {
items.push(this.api.asc_getWorksheetName(i));
}
while (true) {
if (Ext.Array.contains(items, tn)) {
nameindex++;
if (nameindex > 100) {
return "";
}
tn = firstname + "(" + nameindex + ")";
} else {
break;
}
}
return tn;
},
_copyWorksheet: function (cut) {
var me = this;
var wc = me.api.asc_getWorksheetsCount(),
i = -1;
var items = [];
while (++i < wc) {
if (!this.api.asc_isWorksheetHidden(i)) {
items.push({
name: me.api.asc_getWorksheetName(i).replace(/\s/g, "&nbsp;"),
sheetindex: i
});
}
}
if (items.length) {
items.push({
name: cut ? me.itemMoveToEnd : me.itemCopyToEnd,
sheetindex: -255
});
}
var win = Ext.create("SSE.view.SheetCopyDialog", {
title: cut ? me.itemMoveWS : me.itemCopyWS,
listtitle: cut ? this.textMoveBefore : undefined,
names: items
});
win.addListener("onmodalresult", function (o, mr, i) {
if (mr && me.api) {
if (cut) {
me.api.asc_moveWorksheet(i == -255 ? wc : i);
} else {
var new_text = me._getSheetCopyName(me.api.asc_getWorksheetName(me.api.asc_getActiveWorksheetIndex()));
me.api.asc_copyWorksheet(i == -255 ? wc : i, new_text);
}
}
me.fireEvent("editcomplete", me);
},
false);
win.show();
},
_showWorksheet: function (show, index) {
Ext.menu.Manager.hideAll();
if (!show && this.barWorksheets.items.items.length == 2) {
Ext.Msg.show({
title: this.textWarning,
msg: this.errorLastSheet,
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OK
});
return;
}
this.api[show ? "asc_showWorksheet" : "asc_hideWorksheet"](index);
},
_onStartEditCell: function (isstart) {
this.txtZoom.setDisabled(isstart);
this.btnZoomIn.setDisabled(isstart);
this.btnZoomOut.setDisabled(isstart);
},
_onActiveSheetChanged: function (index) {
var seltab, item, ic = this.barWorksheets.items.items.length;
while (! (--ic < 0)) {
item = this.barWorksheets.items.items[ic];
if (item.sheetindex == index) {
seltab = item;
break;
}
}
if (seltab) {
this.barWorksheets.setActiveTab(seltab);
}
},
createDelayedElements: function () {
var me = this;
this.btnZoomIn.getEl().set({
"data-qtip": me.tipZoomIn,
"data-qalign": "bl-tl?"
});
this.btnZoomOut.getEl().set({
"data-qtip": me.tipZoomOut,
"data-qalign": "bl-tl?"
});
this.btnZoomIn.on("click", function () {
var f = me.api.asc_getZoom() + 0.1;
if (f > 0 && !(f > 2)) {
me.api.asc_setZoom(f);
}
});
this.btnZoomOut.on("click", function () {
var f = me.api.asc_getZoom() - 0.1;
if (! (f < 0.5)) {
me.api.asc_setZoom(f);
}
});
this.barWorksheets.on("change", this._onTabClick, this);
this.barWorksheets.getEl().on({
contextmenu: {
fn: function (event, docElement, eOpts) {
var tab = /x-tab(?!\S)/.test(docElement.className) ? docElement : Ext.fly(docElement).up(".x-tab");
tab && me._onTabContextMenu(event, docElement, {
tabid: tab.id
});
},
preventDefault: true
},
dblclick: {
fn: function (event, docElement, eOpts) {
var tab = /x-tab(?!\S)/.test(docElement.className) ? docElement : Ext.fly(docElement).up(".x-tab");
tab && me._onTabDblClick(event, docElement, {
tabid: tab.id
});
},
preventDefault: true
}
});
this.barWorksheets.getPlugin("scheetreorderer").on({
drop: function (obj, tabbar, tab, idx, nidx, opts) {
if (nidx != idx) {
obj.lock();
tab.newindex = nidx;
tab.reorderable = false;
}
}
});
this.menuZoomTo = Ext.widget("menu", {
plain: true,
bodyCls: "status-zoom-menu",
minWidth: 100,
listeners: {
click: function (menu, item) {
if (me.api) {
me.api.asc_setZoom(item.fz);
}
me.onZoomChange(item.fz);
me.fireEvent("editcomplete", me);
}
},
items: [{
text: "50%",
fz: 0.5
},
{
text: "75%",
fz: 0.75
},
{
text: "100%",
fz: 1
},
{
text: "125%",
fz: 1.25
},
{
text: "150%",
fz: 1.5
},
{
text: "175%",
fz: 1.75
},
{
text: "200%",
fz: 2
}]
});
this.ssMenu = Ext.widget("menu", {
showSeparator: false,
bodyCls: "no-icons",
listeners: {
hide: function (cnt, eOpt) {
me.fireEvent("editcomplete", me);
},
click: function (menu, item) {
if (!item.isDisabled()) {
if (item.action == "ins") {
me._insertWorksheet();
} else {
if (item.action == "del") {
me._deleteWorksheet();
} else {
if (item.action == "ren") {
me._renameWorksheet();
} else {
if (item.action == "copy") {
me._copyWorksheet(false);
} else {
if (item.action == "move") {
me._copyWorksheet(true);
} else {
if (item.action == "hide") {
me._showWorksheet(false);
}
}
}
}
}
}
}
}
},
items: [{
text: this.itemInsertWS,
action: "ins"
},
{
text: this.itemDeleteWS,
action: "del"
},
{
text: this.itemRenameWS,
action: "ren"
},
{
text: this.itemCopyWS,
action: "copy"
},
{
text: this.itemMoveWS,
action: "move"
},
{
text: this.itemHideWS,
action: "hide"
},
{
text: this.itemHidenWS,
hideOnClick: false,
menu: {
showSeparator: false,
items: [],
listeners: {
click: function (menu, item) {
me._showWorksheet(true, item.sheetindex);
}
}
}
}]
});
},
onCoAuthoringDisconnect: function () {
this.permissions.isEdit = false;
this.barWorksheets.getPlugin("scheetreorderer").setDisabled(true);
this.updateInfo();
},
onWorkbookLocked: function (locked) {
this.barWorksheets[locked ? "addCls" : "removeCls"]("coauth-locked");
var item, ic = this.barWorksheets.items.items.length;
while (! (--ic < 0)) {
item = this.barWorksheets.items.items[ic];
if (item.sheetindex >= 0) {
if (locked) {
item.reorderable = false;
} else {
item.reorderable = !this.api.asc_isWorksheetLockedOrDeleted(item.sheetindex);
}
} else {
item.setDisabled(locked);
}
}
},
onWorksheetLocked: function (index, locked) {
var tabs = this.barWorksheets.items.items;
for (var i = 0; i < tabs.length; i++) {
if (index == tabs[i].sheetindex) {
tabs[i][locked ? "addCls" : "removeCls"]("coauth-locked");
tabs[i].reorderable = !locked;
break;
}
}
},
zoomText: "Zoom {0}%",
tipZoomIn: "Zoom In",
tipZoomOut: "Zoom Out",
tipZoomFactor: "Magnification",
txtFirst: "First Sheet",
txtLast: "Last Sheet",
txtPrev: "Previous Sheet",
txtNext: "Next Sheet",
itemInsertWS: "Insert",
itemDeleteWS: "Delete",
itemRenameWS: "Rename",
itemCopyWS: "Copy",
itemMoveWS: "Move",
itemHideWS: "Hide",
itemHidenWS: "Hiden",
itemCopyToEnd: "(Copy to end)",
itemMoveToEnd: "(Move to end)",
msgDelSheetError: "Can't delete the worksheet.",
textMoveBefore: "Move before sheet",
warnDeleteSheet: "The worksheet maybe has data. Proceed operation?",
errorLastSheet : "Workbook must have at least one visible worksheet.",
strSheet: "Sheet",
textError: "Error",
textWarning: "Warning",
textCancel: "Cancel"
});

View File

@@ -1,391 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.File", {
extend: "Ext.panel.Panel",
alias: "widget.ssefile",
cls: "sse-file-body",
layout: "card",
btnSaveCaption: "Save",
btnDownloadCaption: "Download as...",
btnInfoCaption: "Document Info...",
btnCreateNewCaption: "Create New...",
btnRecentFilesCaption: "Open Recent...",
btnPrintCaption: "Print",
btnHelpCaption: "Help...",
btnReturnCaption: "Back to Document",
btnToEditCaption: "Edit Document",
btnBackCaption: "Go to Documents",
btnSettingsCaption: "Advanced Settings...",
toolbarWidth: 260,
activeBtn: undefined,
uses: ["Ext.container.Container", "Ext.toolbar.Toolbar", "Ext.button.Button", "SSE.view.DocumentInfo", "SSE.view.RecentFiles", "SSE.view.CreateFile", "SSE.view.DocumentHelp", "SSE.view.DocumentSettings"],
listeners: {
afterrender: function (Component, eOpts) {
var cnt = this.ownerCt;
if (Ext.isDefined(cnt)) {
cnt.addListener("show", Ext.Function.bind(this._onShow, this));
}
}
},
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
var me = this;
this.addEvents("editdocument", "downloadas");
this.callParent(arguments);
},
loadConfig: function (data) {
this.editorConfig = data.config;
},
_onShow: function () {
if (this.activeBtn === undefined) {
this.activeBtn = this.btnDownloadAs.isVisible() ? this.btnCreateNew : this.btnDocumentInfo;
}
if (this.activeBtn == this.btnDocumentInfo) {
this.getLayout().setActiveItem(this.cardDocumentInfo);
} else {
if (this.activeBtn == this.btnDocumentSettings) {
this.getLayout().setActiveItem(this.cardDocumentSettings);
this.cardDocumentSettings.updateSettings();
} else {
if (this.activeBtn == this.btnCreateNew) {
if (this.btnDownloadAs.isVisible()) {
this.getLayout().setActiveItem(this.cardDownloadAs);
this.activeBtn = this.btnDownloadAs;
} else {
this.getLayout().setActiveItem(this.cardDocumentInfo);
this.activeBtn = this.btnDocumentInfo;
}
}
}
}
this.redrawButton(this.activeBtn);
},
buildDockedItems: function () {
this.btnSave = Ext.create("Ext.button.Button", {
id: "file-button-save",
text: this.btnSaveCaption,
textAlign: "left",
enableToggle: true,
cls: "asc-filemenu-btn",
padding: "0 27px",
height: 27,
listeners: {
click: Ext.bind(function (btnCall) {
if (btnCall.pressed) {
this.api = this.ownerCt.getApi();
if (this.api) {
this.redrawButton(btnCall);
this.api.asc_Save();
this.closeMenu();
}
Common.component.Analytics.trackEvent("Save");
Common.component.Analytics.trackEvent("File Menu", "Save");
}
},
this)
}
});
this.btnPrint = this.btnSave.cloneConfig({
id: "file-button-print",
text: this.btnPrintCaption,
listeners: {
click: Ext.bind(function (btnCall) {
if (btnCall.pressed) {
this.api = this.ownerCt.getApi();
if (this.api) {
this.api.asc_Print();
this.closeMenu();
}
Common.component.Analytics.trackEvent("Print");
Common.component.Analytics.trackEvent("File Menu", "Print");
}
},
this)
}
});
this.btnToEdit = this.btnSave.cloneConfig({
id: "file-button-edit",
text: this.btnToEditCaption,
listeners: {
click: Ext.bind(function (btnCall) {
this.redrawButton(btnCall);
if (btnCall.pressed) {
this.closeMenu();
this.fireEvent("editdocument");
Common.component.Analytics.trackEvent("Edit");
Common.component.Analytics.trackEvent("File Menu", "Edit");
}
},
this)
}
});
this.btnDownloadAs = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnDownloadCaption, this.cardDownloadAs), {
id: "file-button-download"
}));
this.btnDocumentInfo = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnInfoCaption, this.cardDocumentInfo), {
id: "file-button-info"
}));
this.btnDocumentSettings = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnSettingsCaption, this.cardDocumentSettings), {
id: "file-button-settings"
}));
this.btnBack = this.btnPrint.cloneConfig({
id: "file-button-back",
text: this.btnBackCaption,
listeners: {
click: Ext.bind(function (btnCall) {
this.redrawButton(btnCall);
if (btnCall.pressed) {
Common.Gateway.goBack();
this.closeMenu();
}
},
this)
}
});
this.btnHelp = Ext.create("Ext.button.Button", this.getFileMenuButton(this.btnHelpCaption, this.cardHelp));
this.btnReturn = Ext.create("Ext.button.Button", {
id: "file-button-return",
text: this.btnReturnCaption,
textAlign: "left",
enableToggle: true,
cls: "asc-filemenu-btn",
padding: "0 27px",
height: 27,
listeners: {
click: Ext.bind(function (btnCall) {
if (btnCall.pressed) {
this.closeMenu();
Common.component.Analytics.trackEvent("File Menu", "Return");
}
},
this)
}
});
this.btnCreateNew = Ext.create("Ext.button.Button", Ext.apply(this.getFileMenuButton(this.btnCreateNewCaption, this.cardCreateNew), {
id: "file-button-createnew",
label: "Create",
listeners: {},
enableToggle: false
}));
this.btnOpenRecent = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnRecentFilesCaption, this.cardRecentFiles), {
id: "file-button-recentfiles",
label: "Recent"
}));
this.tbFileMenu = Ext.create("Ext.toolbar.Toolbar", {
dock: "left",
layout: {
type: "vbox",
align: "stretch"
},
cls: "sse-file-toolbar",
vertical: true,
width: this.toolbarWidth,
defaults: {
height: 22,
width: "100%"
},
items: [{
xtype: "container",
height: 15
},
this.btnReturn, this.getSeparator(), this.btnSave, this.btnToEdit, this.btnDownloadAs, this.btnPrint, this.getSeparator(), this.btnOpenRecent, this.btnCreateNew, this.getSeparator(), this.btnDocumentInfo, this.getSeparator(), this.btnDocumentSettings, this.getSeparator(), this.btnHelp, this.getSeparator(), this.btnBack]
});
return this.tbFileMenu;
},
setApi: function (api) {
this.api = api;
},
getSeparator: function () {
return {
xtype: "container",
html: '<hr class="sse-file-separator" />'
};
},
getFileMenuButton: function (caption, card) {
return {
text: caption,
textAlign: "left",
enableToggle: true,
cls: "asc-filemenu-btn",
padding: "0 27px",
height: 27,
listeners: {
click: Ext.Function.bind(this._itemClick, this, [card], true),
toggle: Ext.Function.bind(this._itemTogglge, this)
}
};
},
redrawButton: function (btnCall) {
var tb = this.tbFileMenu;
for (var i = 0; i < tb.items.length; i++) {
var btn = tb.items.items[i];
if (btn.componentCls === "x-btn") {
if (btn.id != btnCall.id && btn.pressed) {
btn.toggle(false, true);
}
}
}
btnCall.toggle(true, true);
},
closeMenu: function () {
this.ownerCt.closeMenu();
},
_itemClick: function (btnCall, event, opt, card) {
if (btnCall.pressed) {
if (this.activeBtn != btnCall) {
this.getLayout().setActiveItem(card);
this.activeBtn = btnCall;
}
Common.component.Analytics.trackEvent("File Menu", btnCall.label);
}
},
_itemTogglge: function (btnCall) {
this.redrawButton(btnCall);
},
applyMode: function () {
this.btnDownloadAs.setVisible(this.mode.canDownload);
this.hkSaveAs[this.mode.canDownload ? "enable" : "disable"]();
this.hkSave[this.mode.isEdit ? "enable" : "disable"]();
this.hkHelp.enable();
this.btnSave.setVisible(this.mode.isEdit);
this.btnToEdit.setVisible(this.mode.canEdit && this.mode.isEdit === false);
this.btnDocumentSettings.setVisible(this.mode.isEdit);
this.tbFileMenu.items.items[14].setVisible(this.mode.isEdit);
this.btnBack.setVisible(this.mode.canBack);
this.tbFileMenu.items.items[16].setVisible(this.mode.canBack);
this.btnOpenRecent.setVisible(this.mode.canOpenRecent);
this.btnCreateNew.setVisible(this.mode.canCreateNew);
this.tbFileMenu.items.items[10].setVisible(this.mode.canCreateNew || this.mode.canOpenRecent);
this.cardDocumentSettings.setMode(this.mode);
},
setMode: function (mode, delay) {
if (mode.isDisconnected) {
this.mode.canEdit = this.mode.isEdit = false;
this.mode.canOpenRecent = this.mode.canCreateNew = false;
} else {
this.mode = mode;
}
if (!delay) {
this.applyMode();
}
},
createDelayedElements: function () {
var me = this;
this.hkSaveAs = new Ext.util.KeyMap(document, [{
key: "s",
ctrl: true,
shift: true,
defaultEventAction: "stopEvent",
fn: function () {
if (me.ownerCt && me.ownerCt.isVisible()) {
me.btnDownloadAs.toggle(true);
me.btnDownloadAs.fireEvent("click", me.btnDownloadAs);
}
}
}]);
this.hkSave = new Ext.util.KeyMap(document, [{
key: "s",
ctrl: true,
shift: false,
defaultEventAction: "stopEvent",
fn: function () {
if (canHotKey()) {
var api = me.ownerCt.getApi();
if (api) {
api.asc_Save();
}
}
}
}]);
this.hkHelp = new Ext.util.KeyMap(document, {
key: Ext.EventObject.F1,
ctrl: false,
shift: false,
defaultEventAction: "stopEvent",
fn: function () {
if (me.ownerCt && me.ownerCt.isVisible()) {
me.btnHelp.toggle(true);
me.btnHelp.fireEvent("click", me.btnHelp, [me.cardHelp]);
}
}
});
var docInfo = [{
name: "XLSX",
imgCls: "tabular-format btn-xlsx",
type: c_oAscFileType.XLSX
}];
this.cardDownloadAs = Ext.widget("container", {
cls: "sse-file-table",
layout: {
type: "table",
columns: 2
}
});
Ext.each(docInfo, function (item) {
this.cardDownloadAs.add({
xtype: "container",
items: [{
xtype: "button",
id: "file-format-" + item.name,
cls: item.imgCls + " download-button-style",
docType: item.type,
width: 102,
height: 129,
margin: "65px 25px 0 25px"
}]
});
},
this);
this.cardDocumentInfo = Ext.widget("ssedocumentinfo");
this.cardCreateNew = Ext.widget("ssecreatenew");
this.cardRecentFiles = Ext.widget("sserecentfiles");
this.cardHelp = Ext.widget("ssedocumenthelp");
this.cardDocumentSettings = Ext.widget("ssedocumentsettings");
this.cardDocumentSettings.addListener("savedocsettings", Ext.bind(this.closeMenu, this));
this.add([this.cardDownloadAs, this.cardHelp, this.cardDocumentInfo, this.cardRecentFiles, this.cardDocumentSettings]);
this.addDocked(this.buildDockedItems());
this.setConfig();
this.applyMode();
},
setConfig: function () {
this.cardHelp.setLangConfig(this.editorConfig.lang);
if (this.editorConfig.templates && this.editorConfig.templates.length > 0) {
this.btnCreateNew.enableToggle = true;
this.btnCreateNew.on("click", Ext.bind(this._itemClick, this, [this.cardCreateNew], true));
this.btnCreateNew.on("toggle", Ext.bind(this._itemTogglge, this));
}
}
});

View File

@@ -0,0 +1,243 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/FileMenu.template", "underscore", "common/main/lib/component/BaseView"], function (tpl, _) {
SSE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({
el: "#file-menu-panel",
template: _.template(tpl),
events: function () {
return {
"click .fm-btn": _.bind(function (event) {
var $item = $(event.currentTarget);
if (!$item.hasClass("active")) {
$(".fm-btn", this.el).removeClass("active");
$item.addClass("active");
}
var item = _.findWhere(this.items, {
el: event.currentTarget
});
if (item) {
var panel = this.panels[item.options.action];
this.fireEvent("item:click", [this, item.options.action, !!panel]);
if (panel) {
this.$el.find(".content-box:visible").hide();
this.active = item.options.action;
panel.show();
}
}
},
this)
};
},
initialize: function () {},
render: function () {
this.$el = $(this.el);
this.$el.html(this.template());
this.items = [];
this.items.push(new Common.UI.MenuItem({
el: $("#fm-btn-return", this.el),
action: "back",
caption: this.btnReturnCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-save", this.el),
action: "save",
caption: this.btnSaveCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-edit", this.el),
action: "edit",
caption: this.btnToEditCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-download", this.el),
action: "saveas",
caption: this.btnDownloadCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-print", this.el),
action: "print",
caption: this.btnPrintCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-recent", this.el),
action: "recent",
caption: this.btnRecentFilesCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-create", this.el),
action: "new",
caption: this.btnCreateNewCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-info", this.el),
action: "info",
caption: this.btnInfoCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-settings", this.el),
action: "opts",
caption: this.btnSettingsCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-help", this.el),
action: "help",
caption: this.btnHelpCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-back", this.el),
action: "exit",
caption: this.btnBackCaption,
canFocused: false
}));
var me = this;
this.panels = {};
require(["spreadsheeteditor/main/app/view/FileMenuPanels"], function () {
me.panels = {
"saveas": (new SSE.Views.FileMenuPanels.ViewSaveAs({
menu: me
})).render(),
"opts": (new SSE.Views.FileMenuPanels.Settings({
menu: me
})).render(),
"info": (new SSE.Views.FileMenuPanels.DocumentInfo({
menu: me
})).render(),
"help": (new SSE.Views.FileMenuPanels.Help({
menu: me
})).render()
};
me.$el.find(".content-box").hide();
});
return this;
},
show: function (panel) {
if (this.isVisible() && panel === undefined) {
return;
}
if (!panel) {
panel = this.active || (this.mode.canDownload ? "saveas" : "info");
}
this.$el.show();
this.selectMenu(panel);
if (this.mode.isEdit) {
SSE.getController("Toolbar").DisableToolbar(true);
}
this.api.asc_enableKeyEvents(false);
},
hide: function () {
this.$el.hide();
if (this.mode.isEdit) {
SSE.getController("Toolbar").DisableToolbar(false);
}
this.api.asc_enableKeyEvents(true);
},
applyMode: function () {
this.items[0][this.mode.canBack ? "show" : "hide"]();
this.items[0].$el.find("+.devider")[this.mode.canBack ? "show" : "hide"]();
this.items[5][this.mode.canOpenRecent ? "show" : "hide"]();
this.items[6][this.mode.canCreateNew ? "show" : "hide"]();
this.items[6].$el.find("+.devider")[this.mode.canCreateNew ? "show" : "hide"]();
this.items[3][this.mode.canDownload ? "show" : "hide"]();
this.items[1][this.mode.isEdit ? "show" : "hide"]();
this.items[2][!this.mode.isEdit && this.mode.canEdit ? "show" : "hide"]();
this.items[8][this.mode.isEdit ? "show" : "hide"]();
this.items[8].$el.find("+.devider")[this.mode.isEdit ? "show" : "hide"]();
this.panels["opts"].setMode(this.mode);
this.panels["info"].setMode(this.mode).updateInfo(this.document);
if (this.mode.canCreateNew) {
if (this.mode.templates && this.mode.templates.length) {
$("a", this.items[6].$el).text(this.btnCreateNewCaption + "...");
this.panels["new"] = ((new SSE.Views.FileMenuPanels.CreateNew({
menu: this,
docs: this.mode.templates
})).render());
}
}
if (this.mode.canOpenRecent) {
if (this.mode.recent) {
this.panels["recent"] = (new SSE.Views.FileMenuPanels.RecentFiles({
menu: this,
recent: this.mode.recent
})).render();
}
}
this.panels["help"].setLangConfig(this.mode.lang);
},
setMode: function (mode, delay) {
if (mode.isDisconnected) {
this.mode.canEdit = this.mode.isEdit = false;
this.mode.canOpenRecent = this.mode.canCreateNew = false;
} else {
this.mode = mode;
}
if (!delay) {
this.applyMode();
}
},
setApi: function (api) {
this.api = api;
},
loadDocument: function (data) {
this.document = data.doc;
},
selectMenu: function (menu) {
if (menu) {
var item = this._getMenuItem(menu),
panel = this.panels[menu];
if (item && panel) {
$(".fm-btn", this.el).removeClass("active");
item.$el.addClass("active");
this.$el.find(".content-box:visible").hide();
panel.show();
this.active = menu;
}
}
},
_getMenuItem: function (action) {
return _.find(this.items, function (item) {
return item.options.action == action;
});
},
btnSaveCaption: "Save",
btnDownloadCaption: "Download as...",
btnInfoCaption: "Document Info...",
btnCreateNewCaption: "Create New",
btnRecentFilesCaption: "Open Recent...",
btnPrintCaption: "Print",
btnHelpCaption: "Help...",
btnReturnCaption: "Back to Document",
btnToEditCaption: "Edit Document",
btnBackCaption: "Go to Documents",
btnSettingsCaption: "Advanced Settings..."
},
SSE.Views.FileMenu || {}));
});

View File

@@ -0,0 +1,878 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["common/main/lib/view/DocumentAccessDialog"], function () { ! SSE.Views.FileMenuPanels && (SSE.Views.FileMenuPanels = {});
SSE.Views.FileMenuPanels.ViewSaveAs = Common.UI.BaseView.extend({
el: "#panel-saveas",
menu: undefined,
formats: [[{
name: "XLSX",
imgCls: "xlsx",
type: c_oAscFileType.XLSX
},
{
name: "ODS",
imgCls: "ods",
type: c_oAscFileType.ODS
}], [{
name: "CSV",
imgCls: "csv",
type: c_oAscFileType.CSV
},
{
name: "HTML",
imgCls: "html",
type: c_oAscFileType.HTML
}]],
template: _.template(["<table><tbody>", "<% _.each(rows, function(row) { %>", "<tr>", "<% _.each(row, function(item) { %>", '<td><span class="btn-doc-format <%= item.imgCls %>" /></td>', "<% }) %>", "</tr>", "<% }) %>", "</tbody></table>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template({
rows: this.formats
}));
$(".btn-doc-format", this.el).on("click", _.bind(this.onFormatClick, this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
this.flatFormats = _.flatten(this.formats);
return this;
},
onFormatClick: function (e) {
var format = /\s(\w+)/.exec(e.currentTarget.className);
if (format) {
format = format[1];
var item = _.findWhere(this.flatFormats, {
imgCls: format
});
if (item && this.menu) {
this.menu.fireEvent("saveas:format", [this.menu, item.type]);
}
}
}
});
SSE.Views.FileMenuPanels.Settings = Common.UI.BaseView.extend(_.extend({
el: "#panel-settings",
menu: undefined,
template: _.template(['<div style="width:100%; height:100%; position: relative;">', '<div id="id-settings-menu" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>', '<div id="id-settings-content" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding">', '<div id="panel-settings-general" style="width:100%; height:100%;" class="no-padding main-settings-panel active"></div>', '<div id="panel-settings-print" style="width:100%; height:100%;" class="no-padding main-settings-panel"></div>', "</div>", "</div>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template());
this.generalSettings = new SSE.Views.FileMenuPanels.MainSettingsGeneral({
menu: this.menu
});
this.generalSettings.options = {
alias: "MainSettingsGeneral"
};
this.generalSettings.render();
this.printSettings = SSE.getController("Print").getView("MainSettingsPrint");
this.printSettings.menu = this.menu;
this.printSettings.render($("#panel-settings-print"));
this.viewSettingsPicker = new Common.UI.DataView({
el: $("#id-settings-menu"),
store: new Common.UI.DataViewStore([{
name: this.txtGeneral,
panel: this.generalSettings,
iconCls: "mnu-settings-general",
selected: true
},
{
name: this.txtPrint,
panel: this.printSettings,
iconCls: "mnu-print"
}]),
itemTemplate: _.template(['<div id="<%= id %>" class="settings-item-wrap">', '<div><span class="settings-icon <%= iconCls %>"/><span class="caption"><%= name %></span></div>', "</div>"].join(""))
});
this.viewSettingsPicker.on("item:select", _.bind(function (dataview, itemview, record) {
var panel = record.get("panel");
$("#id-settings-content > div").removeClass("active");
panel.$el.addClass("active");
panel.show();
},
this));
return this;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this, arguments);
var item = this.viewSettingsPicker.getSelectedRec();
if (item[0]) {
item[0].get("panel").show();
}
},
setMode: function (mode) {
this.mode = mode;
this.generalSettings && this.generalSettings.setMode(this.mode);
},
txtGeneral: "General",
txtPrint: "Print"
},
SSE.Views.FileMenuPanels.Settings || {}));
SSE.Views.MainSettingsPrint = Common.UI.BaseView.extend(_.extend({
menu: undefined,
template: _.template(['<table class="main"><tbody>', "<tr>", '<td class="left"><label><%= scope.textSettings %></label></td>', '<td class="right"><div id="advsettings-print-combo-sheets" class="input-group-nr" /></td>', "</tr>", '<tr class="divider"></tr>', '<tr class="divider"></tr>', "<tr>", '<td class="left"><label><%= scope.textPageSize %></label></td>', '<td class="right"><div id="advsettings-print-combo-pages" class="input-group-nr" /></td>', "</tr>", '<tr class="divider"></tr>', "<tr>", '<td class="left"><label><%= scope.textPageOrientation %></label></td>', '<td class="right"><span id="advsettings-print-combo-orient" /></td>', "</tr>", '<tr class="divider"></tr>', "<tr>", '<td class="left" style="vertical-align: top;"><label><%= scope.strMargins %></label></td>', '<td class="right" style="vertical-align: top;"><div id="advsettings-margins">', '<table cols="2" class="no-padding">', "<tr>", "<td><label><%= scope.strTop %></label></td>", "<td><label><%= scope.strBottom %></label></td>", "</tr>", "<tr>", '<td><div id="advsettings-spin-margin-top"></div></td>', '<td><div id="advsettings-spin-margin-bottom"></div></td>', "</tr>", "<tr>", "<td><label><%= scope.strLeft %></label></td>", "<td><label><%= scope.strRight %></label></td>", "</tr>", "<tr>", '<td><div id="advsettings-spin-margin-left"></div></td>', '<td><div id="advsettings-spin-margin-right"></div></td>', "</tr>", "</table>", "</div></td>", "</tr>", '<tr class="divider"></tr>', "<tr>", '<td class="left" style="vertical-align: top;"><label><%= scope.strPrint %></label></td>', '<td class="right" style="vertical-align: top;"><div id="advsettings-print">', '<div id="advsettings-print-chb-grid" style="margin-bottom: 10px;"/>', '<div id="advsettings-print-chb-rows"/>', "</div></td>", "</tr>", '<tr class="divider"></tr>', '<tr class="divider"></tr>', "<tr>", '<td class="left"></td>', '<td class="right"><button id="advsettings-print-button-save" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>', "</tr>", "</tbody></table>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
this.spinners = [];
this._initSettings = true;
},
render: function (parentEl) {
if (parentEl) {
this.setElement(parentEl, false);
}
$(this.el).html(this.template({
scope: this
}));
this.cmbSheet = new Common.UI.ComboBox({
el: $("#advsettings-print-combo-sheets"),
style: "width: 260px;",
menuStyle: "min-width: 260px;max-height: 280px;",
editable: false,
cls: "input-group-nr",
data: [{
value: -255,
displayValue: this.strAllSheets
}]
});
this.cmbPaperSize = new Common.UI.ComboBox({
el: $("#advsettings-print-combo-pages"),
style: "width: 260px;",
menuStyle: "max-height: 280px; min-width: 260px;",
editable: false,
cls: "input-group-nr",
data: [{
value: "215.9|279.4",
displayValue: "US Letter (21,59cm x 27,94cm)"
},
{
value: "215.9|355.6",
displayValue: "US Legal (21,59cm x 35,56cm)"
},
{
value: "210|297",
displayValue: "A4 (21cm x 29,7cm)"
},
{
value: "148.1|209.9",
displayValue: "A5 (14,81cm x 20,99cm)"
},
{
value: "176|250.1",
displayValue: "B5 (17,6cm x 25,01cm)"
},
{
value: "104.8|241.3",
displayValue: "Envelope #10 (10,48cm x 24,13cm)"
},
{
value: "110.1|220.1",
displayValue: "Envelope DL (11,01cm x 22,01cm)"
},
{
value: "279.4|431.7",
displayValue: "Tabloid (27,94cm x 43,17cm)"
},
{
value: "297|420.1",
displayValue: "A3 (29,7cm x 42,01cm)"
},
{
value: "304.8|457.1",
displayValue: "Tabloid Oversize (30,48cm x 45,71cm)"
},
{
value: "196.8|273",
displayValue: "ROC 16K (19,68cm x 27,3cm)"
},
{
value: "119.9|234.9",
displayValue: "Envelope Choukei 3 (11,99cm x 23,49cm)"
},
{
value: "330.2|482.5",
displayValue: "Super B/A3 (33,02cm x 48,25cm)"
}]
});
this.cmbPaperOrientation = new Common.UI.ComboBox({
el: $("#advsettings-print-combo-orient"),
style: "width: 200px;",
menuStyle: "min-width: 200px;",
editable: false,
cls: "input-group-nr",
data: [{
value: c_oAscPageOrientation.PagePortrait,
displayValue: this.strPortrait
},
{
value: c_oAscPageOrientation.PageLandscape,
displayValue: this.strLandscape
}]
});
this.chPrintGrid = new Common.UI.CheckBox({
el: $("#advsettings-print-chb-grid"),
labelText: this.textPrintGrid
});
this.chPrintRows = new Common.UI.CheckBox({
el: $("#advsettings-print-chb-rows"),
labelText: this.textPrintHeadings
});
this.spnMarginTop = new Common.UI.MetricSpinner({
el: $("#advsettings-spin-margin-top"),
step: 0.1,
width: 90,
defaultUnit: "cm",
value: "0 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginTop);
this.spnMarginBottom = new Common.UI.MetricSpinner({
el: $("#advsettings-spin-margin-bottom"),
step: 0.1,
width: 90,
defaultUnit: "cm",
value: "0 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginBottom);
this.spnMarginLeft = new Common.UI.MetricSpinner({
el: $("#advsettings-spin-margin-left"),
step: 0.1,
width: 90,
defaultUnit: "cm",
value: "0.19 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginLeft);
this.spnMarginRight = new Common.UI.MetricSpinner({
el: $("#advsettings-spin-margin-right"),
step: 0.1,
width: 90,
defaultUnit: "cm",
value: "0.19 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginRight);
this.btnOk = new Common.UI.Button({
el: "#advsettings-print-button-save"
});
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
this.fireEvent("render:after", this);
return this;
},
updateMetricUnit: function () {
if (this.spinners) {
for (var i = 0; i < this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
applySettings: function () {
if (this.menu) {
this.menu.fireEvent("settings:apply", [this.menu]);
}
},
show: function () {
Common.UI.BaseView.prototype.show.call(this, arguments);
if (this._initSettings) {
this.updateMetricUnit();
this._initSettings = false;
}
this.fireEvent("show", this);
},
okButtonText: "Save",
strPortrait: "Portrait",
strLandscape: "Landscape",
textPrintGrid: "Print Gridlines",
textPrintHeadings: "Print Rows and Columns Headings",
strLeft: "Left",
strRight: "Right",
strTop: "Top",
strBottom: "Bottom",
strMargins: "Margins",
textPageSize: "Page Size",
textPageOrientation: "Page Orientation",
strPrint: "Print",
textSettings: "Settings for"
},
SSE.Views.MainSettingsPrint || {}));
SSE.Views.FileMenuPanels.MainSettingsGeneral = Common.UI.BaseView.extend(_.extend({
el: "#panel-settings-general",
menu: undefined,
template: _.template(['<table class="main"><tbody>', '<tr class="coauth">', '<td class="left"><label><%= scope.txtLiveComment %></label></td>', '<td class="right"><div id="fms-chb-live-comment"/></td>', "</tr>", '<tr class="divider coauth"></tr>', '<tr class="autosave">', '<td class="left"><label><%= scope.textAutoSave %></label></td>', '<td class="right"><span id="fms-chb-autosave" /></td>', "</tr>", '<tr class="divider autosave"></tr>', "<tr>", '<td class="left"><label><%= scope.strZoom %></label></td>', '<td class="right"><div id="fms-cmb-zoom" class="input-group-nr" /></td>', "</tr>", '<tr class="divider"></tr>', "<tr>", '<td class="left"><label><%= scope.strFontRender %></label></td>', '<td class="right"><span id="fms-cmb-font-render" /></td>', "</tr>", '<tr class="divider"></tr>', '<tr class="edit">', '<td class="left"><label><%= scope.strUnit %></label></td>', '<td class="right"><span id="fms-cmb-unit" /></td>', "</tr>", '<tr class="divider edit"></tr>', "<tr>", '<td class="left"></td>', '<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>', "</tr>", "</tbody></table>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template({
scope: this
}));
this.chLiveComment = new Common.UI.CheckBox({
el: $("#fms-chb-live-comment"),
labelText: this.strLiveComment
});
this.cmbZoom = new Common.UI.ComboBox({
el: $("#fms-cmb-zoom"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: 50,
displayValue: "50%"
},
{
value: 60,
displayValue: "60%"
},
{
value: 70,
displayValue: "70%"
},
{
value: 80,
displayValue: "80%"
},
{
value: 90,
displayValue: "90%"
},
{
value: 100,
displayValue: "100%"
},
{
value: 110,
displayValue: "110%"
},
{
value: 120,
displayValue: "120%"
},
{
value: 150,
displayValue: "150%"
},
{
value: 175,
displayValue: "175%"
},
{
value: 200,
displayValue: "200%"
}]
});
this.cmbFontRender = new Common.UI.ComboBox({
el: $("#fms-cmb-font-render"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: c_oAscFontRenderingModeType.hintingAndSubpixeling,
displayValue: this.txtWin
},
{
value: c_oAscFontRenderingModeType.noHinting,
displayValue: this.txtMac
},
{
value: c_oAscFontRenderingModeType.hinting,
displayValue: this.txtNative
}]
});
this.chAutosave = new Common.UI.CheckBox({
el: $("#fms-chb-autosave"),
labelText: this.strAutosave
});
this.cmbUnit = new Common.UI.ComboBox({
el: $("#fms-cmb-unit"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: Common.Utils.Metric.c_MetricUnits["cm"],
displayValue: this.txtCm
},
{
value: Common.Utils.Metric.c_MetricUnits["pt"],
displayValue: this.txtPt
}]
});
this.btnApply = new Common.UI.Button({
el: "#fms-btn-apply"
});
this.btnApply.on("click", _.bind(this.applySettings, this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this, arguments);
this.updateSettings();
},
setMode: function (mode) {
$("tr.autosave", this.el)[mode.isEdit && mode.canAutosave ? "show" : "hide"]();
$("tr.coauth", this.el)[mode.canCoAuthoring && mode.isEdit ? "show" : "hide"]();
},
updateSettings: function () {
var value = window.localStorage.getItem("sse-settings-zoom");
var item = this.cmbZoom.store.findWhere({
value: parseInt(value)
});
this.cmbZoom.setValue(item ? parseInt(item.get("value")) : 100);
value = window.localStorage.getItem("sse-settings-livecomment");
this.chLiveComment.setValue(!(value !== null && parseInt(value) == 0));
value = window.localStorage.getItem("sse-settings-fontrender");
item = this.cmbFontRender.store.findWhere({
value: parseInt(value)
});
this.cmbFontRender.setValue(item ? item.get("value") : (window.devicePixelRatio > 1 ? c_oAscFontRenderingModeType.noHinting : c_oAscFontRenderingModeType.hintingAndSubpixeling));
value = window.localStorage.getItem("sse-settings-unit");
item = this.cmbUnit.store.findWhere({
value: parseInt(value)
});
this.cmbUnit.setValue(item ? parseInt(item.get("value")) : 0);
this._oldUnits = this.cmbUnit.getValue();
value = window.localStorage.getItem("sse-settings-autosave");
this.chAutosave.setValue(value === null || parseInt(value) == 1);
},
applySettings: function () {
window.localStorage.setItem("sse-settings-zoom", this.cmbZoom.getValue());
window.localStorage.setItem("sse-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
window.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue());
window.localStorage.setItem("sse-settings-unit", this.cmbUnit.getValue());
window.localStorage.setItem("sse-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
if (this.menu) {
this.menu.fireEvent("settings:apply", [this.menu]);
if (this._oldUnits !== this.cmbUnit.getValue()) {
Common.NotificationCenter.trigger("settings:unitschanged", this);
}
}
},
strLiveComment: "Turn on option",
strZoom: "Default Zoom Value",
okButtonText: "Apply",
txtLiveComment: "Live Commenting",
txtWin: "as Windows",
txtMac: "as OS X",
txtNative: "Native",
strFontRender: "Font Hinting",
strUnit: "Unit of Measurement",
txtCm: "Centimeter",
txtPt: "Point",
strAutosave: "Turn on autosave",
textAutoSave: "Autosave"
},
SSE.Views.FileMenuPanels.MainSettingsGeneral || {}));
SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
el: "#panel-recentfiles",
menu: undefined,
template: _.template(['<div id="id-recent-view" style="margin: 20px 0;"></div>'].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
this.recent = options.recent;
},
render: function () {
$(this.el).html(this.template());
this.viewRecentPicker = new Common.UI.DataView({
el: $("#id-recent-view"),
store: new Common.UI.DataViewStore(this.recent),
itemTemplate: _.template(['<div class="recent-wrap">', '<div class="recent-icon"></div>', '<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>', '<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>', "</div>"].join(""))
});
this.viewRecentPicker.on("item:click", _.bind(this.onRecentFileClick, this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
onRecentFileClick: function (view, itemview, record) {
if (this.menu) {
this.menu.fireEvent("recent:open", [this.menu, record.get("url")]);
}
}
});
SSE.Views.FileMenuPanels.CreateNew = Common.UI.BaseView.extend(_.extend({
el: "#panel-createnew",
menu: undefined,
events: function () {
return {
"click .blank-document-btn": _.bind(this._onBlankDocument, this),
"click .thumb-list .thumb-wrap": _.bind(this._onDocumentTemplate, this)
};
},
template: _.template(['<h3 style="margin-top: 20px;"><%= scope.fromBlankText %></h3><hr noshade />', '<div class="blank-document">', '<div class="blank-document-btn"></div>', '<div class="blank-document-info">', "<h3><%= scope.newDocumentText %></h3>", "<%= scope.newDescriptionText %>", "</div>", "</div>", "<h3><%= scope.fromTemplateText %></h3><hr noshade />", '<div class="thumb-list">', "<% _.each(docs, function(item) { %>", '<div class="thumb-wrap" template="<%= item.name %>">', '<div class="thumb"<% if (!_.isEmpty(item.icon)) { %> style="background-image: url(<%= item.icon %>);" <% } %> />', '<div class="title"><%= item.name %></div>', "</div>", "<% }) %>", "</div>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template({
scope: this,
docs: this.options[0].docs
}));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
_onBlankDocument: function () {
if (this.menu) {
this.menu.fireEvent("create:new", [this.menu, "blank"]);
}
},
_onDocumentTemplate: function (e) {
if (this.menu) {
this.menu.fireEvent("create:new", [this.menu, e.currentTarget.attributes["template"].value]);
}
},
fromBlankText: "From Blank",
newDocumentText: "New Spreadsheet",
newDescriptionText: "Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",
fromTemplateText: "From Template"
},
SSE.Views.FileMenuPanels.CreateNew || {}));
SSE.Views.FileMenuPanels.DocumentInfo = Common.UI.BaseView.extend(_.extend({
el: "#panel-info",
menu: undefined,
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.rendered = false;
this.template = _.template(['<table class="main">', "<tr>", '<td class="left"><label>' + this.txtTitle + "</label></td>", '<td class="right"><label id="id-info-title">-</label></td>', "</tr>", '<tr class="author">', '<td class="left"><label>' + this.txtAuthor + "</label></td>", '<td class="right"><span class="userLink" id="id-info-author">-</span></td>', "</tr>", '<tr class="placement">', '<td class="left"><label>' + this.txtPlacement + "</label></td>", '<td class="right"><label id="id-info-placement">-</label></td>', "</tr>", '<tr class="date">', '<td class="left"><label>' + this.txtDate + "</label></td>", '<td class="right"><label id="id-info-date">-</label></td>', "</tr>", '<tr class="divider date"></tr>', '<tr class="rights">', '<td class="left" style="vertical-align: top;"><label>' + this.txtRights + "</label></td>", '<td class="right"><div id="id-info-rights"></div></td>', "</tr>", '<tr class="edit-rights">', '<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary" style="margin-right: 10px;width: auto;">' + this.txtBtnAccessRights + "</button></td>", "</tr>", "</table>"].join(""));
this.templateRights = _.template(["<table>", "<% _.each(users, function(item) { %>", "<tr>", '<td><span class="userLink"><%= Common.Utils.String.htmlEncode(item.user) %></span></td>', "<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>", "</tr>", "<% }); %>", "</table>"].join(""));
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template());
this.lblTitle = $("#id-info-title");
this.lblPlacement = $("#id-info-placement");
this.lblDate = $("#id-info-date");
this.lblAuthor = $("#id-info-author");
this.cntRights = $("#id-info-rights");
this.btnEditRights = new Common.UI.Button({
el: "#id-info-btn-edit"
});
this.btnEditRights.on("click", _.bind(this.changeAccessRights, this));
this.rendered = true;
this.updateInfo(this.doc);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this, arguments);
},
hide: function () {
Common.UI.BaseView.prototype.hide.call(this, arguments);
},
updateInfo: function (doc) {
this.doc = doc;
if (!this.rendered) {
return;
}
doc = doc || {};
this.lblTitle.text((doc.title) ? doc.title : "-");
if (doc.info) {
if (doc.info.author) {
this.lblAuthor.text(doc.info.author);
}
this._ShowHideInfoItem("author", doc.info.author !== undefined && doc.info.author !== null);
if (doc.info.created) {
this.lblDate.text(doc.info.created);
}
this._ShowHideInfoItem("date", doc.info.created !== undefined && doc.info.created !== null);
if (doc.info.folder) {
this.lblPlacement.text(doc.info.folder);
}
this._ShowHideInfoItem("placement", doc.info.folder !== undefined && doc.info.folder !== null);
if (doc.info.sharingSettings) {
this.cntRights.html(this.templateRights({
users: doc.info.sharingSettings
}));
}
this._ShowHideInfoItem("rights", doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
this._ShowHideInfoItem("edit-rights", !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights !== true);
} else {
this._ShowHideDocInfo(false);
}
},
_ShowHideInfoItem: function (cls, visible) {
$("tr." + cls, this.el)[visible ? "show" : "hide"]();
},
_ShowHideDocInfo: function (visible) {
this._ShowHideInfoItem("date", visible);
this._ShowHideInfoItem("placement", visible);
this._ShowHideInfoItem("author", visible);
this._ShowHideInfoItem("rights", visible);
this._ShowHideInfoItem("edit-rights", visible);
},
setMode: function (mode) {
this.sharingSettingsUrl = mode.sharingSettingsUrl;
return this;
},
changeAccessRights: function (btn, event, opts) {
var me = this;
var win = new Common.Views.DocumentAccessDialog({
settingsurl: this.sharingSettingsUrl
});
win.on("accessrights", function (obj, rights) {
me.doc.info.sharingSettings = rights;
me.cntRights.html(me.templateRights({
users: me.doc.info.sharingSettings
}));
});
win.show();
},
onLostEditRights: function () {
this._readonlyRights = true;
if (!this.rendered) {
return;
}
this._ShowHideInfoItem("rights", false);
this._ShowHideInfoItem("edit-rights", false);
},
txtTitle: "Document Title",
txtAuthor: "Author",
txtPlacement: "Placement",
txtDate: "Creation Date",
txtRights: "Persons who have rights",
txtBtnAccessRights: "Change access rights"
},
SSE.Views.FileMenuPanels.DocumentInfo || {}));
SSE.Views.FileMenuPanels.Help = Common.UI.BaseView.extend({
el: "#panel-help",
menu: undefined,
template: _.template(['<div style="width:100%; height:100%; position: relative;">', '<div id="id-help-contents" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>', '<div id="id-help-frame" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding"></div>', "</div>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
this.urlPref = "resources/help/en/";
this.itemclicked = false;
this.en_data = [{
src: "UsageInstructions/OpenCreateNew.htm",
name: "Create a new spreadsheet or open an existing one",
headername: "Usage Instructions",
selected: true
},
{
src: "UsageInstructions/ManageSheets.htm",
name: "Manage sheets"
},
{
src: "UsageInstructions/InsertDeleteCells.htm",
name: "Insert or delete cells, rows, and columns"
},
{
src: "UsageInstructions/CopyPasteData.htm",
name: "Copy and paste data"
},
{
src: "UsageInstructions/FontTypeSizeStyle.htm",
name: "Set font type, size, style, and colors"
},
{
src: "UsageInstructions/AlignText.htm",
name: "Align data in cells"
},
{
src: "UsageInstructions/AddBorders.htm",
name: "Add borders"
},
{
src: "UsageInstructions/MergeCells.htm",
name: "Merge cells"
},
{
src: "UsageInstructions/ClearFormatting.htm",
name: "Clear text, format in a cell"
},
{
src: "UsageInstructions/SortData.htm",
name: "Sort data"
},
{
src: "UsageInstructions/InsertFunction.htm",
name: "Insert function"
},
{
src: "UsageInstructions/ChangeNumberFormat.htm",
name: "Change number format"
},
{
src: "UsageInstructions/UndoRedo.htm",
name: "Undo/redo your actions"
},
{
src: "UsageInstructions/ViewDocInfo.htm",
name: "View file information"
},
{
src: "UsageInstructions/SavePrintDownload.htm",
name: "Save/print/download your spreadsheet"
},
{
src: "HelpfulHints/About.htm",
name: "About ONLYOFFICE Spreadsheet Editor",
headername: "Helpful Hints"
},
{
src: "HelpfulHints/SupportedFormats.htm",
name: "Supported Formats of Spreadsheets"
},
{
src: "HelpfulHints/Navigation.htm",
name: "Navigation through Your Spreadsheet"
},
{
src: "HelpfulHints/Search.htm",
name: "Search Function"
},
{
src: "HelpfulHints/KeyboardShortcuts.htm",
name: "Keyboard Shortcuts"
}];
if (Common.Utils.isIE) {
window.onhelp = function () {
return false;
};
}
},
render: function () {
$(this.el).html(this.template());
this.viewHelpPicker = new Common.UI.DataView({
el: $("#id-help-contents"),
store: new Common.UI.DataViewStore([]),
keyMoveDirection: "vertical",
itemTemplate: _.template(['<div id="<%= id %>" class="help-item-wrap">', '<div class="caption"><%= name %></div>', "</div>"].join(""))
});
this.viewHelpPicker.on("item:add", _.bind(function (dataview, itemview, record) {
if (record.has("headername")) {
$(itemview.el).before('<div class="header-name">' + record.get("headername") + "</div>");
}
},
this));
this.viewHelpPicker.on("item:select", _.bind(function (dataview, itemview, record) {
this.itemclicked = true;
this.iFrame.src = this.urlPref + record.get("src");
},
this));
this.iFrame = document.createElement("iframe");
this.iFrame.src = "";
this.iFrame.align = "top";
this.iFrame.frameBorder = "0";
this.iFrame.width = "100%";
this.iFrame.height = "100%";
this.iFrame.onload = _.bind(function () {
if (!this.itemclicked) {
var src = arguments[0].currentTarget.contentDocument.URL;
var rec = this.viewHelpPicker.store.find(function (record) {
return (src.indexOf(record.get("src")) > 0);
});
if (rec) {
this.viewHelpPicker.selectRecord(rec, true);
this.viewHelpPicker.scrollToRecord(rec);
}
}
this.itemclicked = false;
},
this);
$("#id-help-frame").append(this.iFrame);
return this;
},
setLangConfig: function (lang) {
var me = this;
var store = this.viewHelpPicker.store;
if (lang) {
lang = lang.split("-")[0];
var config = {
dataType: "json",
error: function () {
if (me.urlPref.indexOf("resources/help/en/") < 0) {
me.urlPref = "resources/help/en/";
store.url = "resources/help/en/Contents.json";
store.fetch(config);
} else {
me.urlPref = "resources/help/en/";
store.reset(me.en_data);
}
},
success: function () {
var rec = store.at(0);
me.viewHelpPicker.selectRecord(rec);
me.iFrame.src = me.urlPref + rec.get("src");
}
};
store.url = "resources/help/" + lang + "/Contents.json";
store.fetch(config);
this.urlPref = "resources/help/" + lang + "/";
}
},
show: function () {
Common.UI.BaseView.prototype.show.call(this);
if (!this._scrollerInited) {
this.viewHelpPicker.scroller.update();
this._scrollerInited = true;
}
}
});
});

View File

@@ -1,247 +1,334 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.FormulaDialog", {
extend: "Ext.window.Window",
alias: "widget.sseformuladialog",
requires: ["Ext.window.Window", "Common.plugin.GridScrollPane"],
modal: true,
closable: true,
resizable: false,
height: 490,
width: 300,
constrain: true,
padding: "10px 20px 0 20px",
layout: {
type: "vbox",
align: "stretch"
},
initComponent: function () {
var gp_store = Ext.create("SSE.store.FormulaGroups");
this.cmbGroup = Ext.create("Ext.form.field.ComboBox", {
id: "formulas-group-combo",
store: gp_store,
displayField: "groupname",
queryMode: "local",
queryDelay: 1000,
typeAhead: false,
editable: false,
listeners: {
select: function (combo, records, eOpts) {},
specialkey: function (obj, event) {
if (!obj.isExpanded && event.getKey() == Ext.EventObject.ESC) {
this.fireEvent("onmodalresult", this, 0);
this.hide();
}
},
scope: this
}
});
Ext.create("SSE.store.Formulas", {
storeId: "appFormulasStore"
});
var funcList = Ext.create("Ext.grid.Panel", {
activeItem: 0,
id: "formulas-list",
store: Ext.data.StoreManager.lookup("appFormulasStore"),
stateful: true,
stateId: "stateGrid",
scroll: false,
columns: [{
flex: 1,
sortable: false,
dataIndex: "func"
}],
height: 250,
hideHeaders: true,
viewConfig: {
stripeRows: false
},
plugins: [{
pluginId: "scrollpane",
ptype: "gridscrollpane"
}],
listeners: {
itemdblclick: function (o, record, item, index, e, eOpts) {
this.btnOk.fireEvent("click", this.btnOk);
},
select: function (o, record, index, eOpts) {
lblSyntax.setText("Syntax: " + record.data.func + record.data.args);
},
viewready: function (cmp) {
cmp.getView().on("cellkeydown", function (obj, cell, cellIndex, record, row, rowIndex, e) {
if (e.getKey() == Ext.EventObject.ESC) {
this.fireEvent("onmodalresult", this, 0);
this.hide();
return false;
}
},
this);
},
scope: this
}
});
var lblSyntax = Ext.widget("label", {});
this.items = [{
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
height: 57,
width: 260,
items: [{
xtype: "label",
text: this.textGroupDescription,
style: "font-weight: bold;margin:0 0 4px 0;"
},
this.cmbGroup]
},
{
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
height: 277,
width: 260,
items: [{
xtype: "label",
text: this.textListDescription,
style: "font-weight:bold;margin:0 0 4px 0;"
},
funcList]
},
{
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
height: 56,
items: [lblSyntax]
},
{
xtype: "tbspacer",
height: 8,
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
},
{
xtype: "container",
height: 40,
layout: {
type: "vbox",
align: "center",
pack: "center"
},
items: [{
xtype: "container",
width: 182,
height: 24,
layout: {
type: "hbox",
align: "middle"
},
items: [this.btnOk = Ext.widget("button", {
id: "formulas-button-ok",
cls: "asc-blue-button",
width: 86,
height: 22,
margin: "0 5px 0 0",
text: this.okButtonText,
listeners: {
click: function (btn) {
this.fireEvent("onmodalresult", this, 1, funcList.getSelectionModel().selected.items[0].data.func);
},
scope: this
}
}), this.btnCancel = Ext.widget("button", {
cls: "asc-darkgray-button",
width: 86,
height: 22,
text: this.cancelButtonText,
listeners: {
click: function (btn) {
this.fireEvent("onmodalresult", this, 0);
this.hide();
},
scope: this
}
})]
}]
}];
this.listeners = {
show: function () {}
};
this.callParent(arguments);
this.setTitle(this.txtTitle);
},
setGroups: function (arr) {
var groupDesc = {
"Cube": this.sCategoryCube,
"Database": this.sCategoryDatabase,
"DateAndTime": this.sCategoryDateTime,
"Engineering": this.sCategoryEngineering,
"Financial": this.sCategoryFinancial,
"Information": this.sCategoryInformation,
"Logical": this.sCategoryLogical,
"LookupAndReference": this.sCategoryLookupAndReference,
"Mathematic": this.sCategoryMathematics,
"Statistical": this.sCategoryStatistical,
"TextAndData": this.sCategoryTextData
};
var garr = [[this.sCategoryAll, "all"]];
Ext.each(arr, function (item) {
garr.push([groupDesc[item], item]);
});
this.cmbGroup.getStore().removeAll(true);
this.cmbGroup.getStore().loadData(garr);
this.cmbGroup.select(this.cmbGroup.getStore().getAt(0));
},
cancelButtonText: "Cancel",
okButtonText: "Ok",
sCategoryAll: "All",
sCategoryLogical: "Logical",
sCategoryCube: "Cube",
sCategoryDatabase: "Database",
sCategoryDateTime: "Date and time",
sCategoryEngineering: "Engineering",
sCategoryFinancial: "Financial",
sCategoryInformation: "Information",
sCategoryLookupAndReference: "LookupAndReference",
sCategoryMathematics: "Math and trigonometry",
sCategoryStatistical: "Statistical",
sCategoryTextData: "Text and data",
textGroupDescription: "Select Function Group",
textListDescription: "Select Function",
sDescription: "Description",
txtTitle: "Insert Function"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["common/main/lib/component/Window", "spreadsheeteditor/main/app/collection/FormulaGroups"], function () {
SSE.Views = SSE.Views || {};
SSE.Views.FormulaDialog = Common.UI.Window.extend(_.extend({
applyFunction: undefined,
initialize: function (options) {
var t = this,
_options = {};
_.extend(_options, {
width: 300,
height: 490,
contentWidth: 390,
header: true,
cls: "formula-dlg",
contentTemplate: "",
title: t.txtTitle,
items: []
},
options);
this.template = options.template || ['<div class="box" style="height:' + (_options.height - 85) + 'px;">', '<div class="content-panel" >', '<label class="header">' + t.textGroupDescription + "</label>", '<div id="formula-dlg-combo-group" class="input-group-nr" style="margin-top: 10px"/>', '<label class="header" style="margin-top:10px">' + t.textListDescription + "</label>", '<div id="formula-dlg-combo-functions" class="combo-functions"/>', '<label id="formula-dlg-args" style="margin-top: 10px">' + "</label>", "</div>", "</div>", '<div class="separator horizontal"/>', '<div class="footer center">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + t.okButtonText + "</button>", '<button class="btn normal dlg-btn" result="cancel">' + t.cancelButtonText + "</button>", "</div>"].join("");
this.api = options.api;
this.formulasGroups = options.formulasGroups;
this.handler = options.handler;
_options.tpl = _.template(this.template, _options);
Common.UI.Window.prototype.initialize.call(this, _options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
this.$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
this.syntaxLabel = $("#formula-dlg-args");
this.fillFormulasGroups();
this.fillFunctions("All");
},
show: function () {
if (this.$window) {
var main_width, main_height, top, left, win_height = this.initConfig.height;
if (window.innerHeight === undefined) {
main_width = document.documentElement.offsetWidth;
main_height = document.documentElement.offsetHeight;
} else {
main_width = window.innerWidth;
main_height = window.innerHeight;
}
top = ((parseInt(main_height, 10) - parseInt(win_height, 10)) / 2) * 0.9;
left = (parseInt(main_width, 10) - parseInt(this.initConfig.width, 10)) / 2;
this.$window.css("left", Math.floor(left));
this.$window.css("top", Math.floor(top));
}
Common.UI.Window.prototype.show.call(this);
this.mask = $(".modals-mask");
this.mask.on("mousedown", _.bind(this.onUpdateFocus, this));
this.$window.on("mousedown", _.bind(this.onUpdateFocus, this));
if (this.cmbListFunctions) {
_.delay(function (me) {
me.cmbListFunctions.$el.find(".listview").focus();
},
100, this);
}
},
hide: function () {
this.mask.off("mousedown", _.bind(this.onUpdateFocus, this));
this.$window.off("mousedown", _.bind(this.onUpdateFocus, this));
Common.UI.Window.prototype.hide.call(this);
},
onBtnClick: function (event) {
if ("ok" === event.currentTarget.attributes["result"].value) {
if (this.handler) {
this.handler.call(this, this.applyFunction);
}
}
this.hide();
},
onDblClickFunction: function () {
if (this.handler) {
this.handler.call(this, this.applyFunction);
}
this.hide();
},
onSelectGroup: function (combo, record) {
if (!_.isUndefined(record) && !_.isUndefined(record.value)) {
if (record.value < this.formulasGroups.length) {
this.fillFunctions(this.formulasGroups.at(record.value).get("name"));
}
}
this.onUpdateFocus();
},
onSelectFunction: function (listView, itemView, record) {
var funcId, functions, func;
if (this.formulasGroups) {
funcId = record.get("id");
if (!_.isUndefined(funcId)) {
functions = this.formulasGroups.at(0).get("functions");
if (functions) {
func = _.find(functions, function (f) {
if (f.get("index") === funcId) {
return f;
}
return null;
});
if (func) {
this.applyFunction = func.get("name");
this.syntaxLabel.text(this.syntaxText + ": " + this.applyFunction + func.get("args"));
}
}
}
}
},
onPrimary: function (list, record, event) {
if (this.handler) {
this.handler.call(this, this.applyFunction);
}
this.hide();
},
onUpdateFocus: function () {
_.delay(function (me) {
me.cmbListFunctions.$el.find(".listview").focus();
},
100, this);
},
fillFormulasGroups: function () {
if (this.formulasGroups) {
var descriptions = {
"All": this.sCategoryAll,
"Cube": this.sCategoryCube,
"Database": this.sCategoryDatabase,
"DateAndTime": this.sCategoryDateTime,
"Engineering": this.sCategoryEngineering,
"Financial": this.sCategoryFinancial,
"Information": this.sCategoryInformation,
"Logical": this.sCategoryLogical,
"LookupAndReference": this.sCategoryLookupAndReference,
"Mathematic": this.sCategoryMathematics,
"Statistical": this.sCategoryStatistical,
"TextAndData": this.sCategoryTextData
};
var i, groupsListItems = [],
length = this.formulasGroups.length;
for (i = 0; i < length; ++i) {
if (this.formulasGroups.at(i).get("functions").length) {
groupsListItems.push({
value: this.formulasGroups.at(i).get("index"),
displayValue: descriptions[this.formulasGroups.at(i).get("name")]
});
}
}
if (!this.cmbFuncGroup) {
this.cmbFuncGroup = new Common.UI.ComboBox({
el: $("#formula-dlg-combo-group"),
menuStyle: "min-width: 268px;",
cls: "input-group-nr",
data: groupsListItems,
editable: false
});
this.cmbFuncGroup.setValue(0);
this.cmbFuncGroup.on("selected", _.bind(this.onSelectGroup, this));
} else {
this.cmbFuncGroup.setData(groupsListItems);
}
}
},
fillFunctions: function (name) {
if (this.formulasGroups) {
if (!this.cmbListFunctions && !this.functions) {
this.functions = new Common.UI.DataViewStore();
this.cmbListFunctions = new Common.UI.ListView({
el: $("#formula-dlg-combo-functions"),
store: this.functions,
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= value %></div>')
});
this.cmbListFunctions.on("item:select", _.bind(this.onSelectFunction, this));
this.cmbListFunctions.on("item:dblclick", _.bind(this.onDblClickFunction, this));
this.cmbListFunctions.on("entervalue", _.bind(this.onPrimary, this));
this.cmbListFunctions.onKeyDown = _.bind(this.onKeyDown, this.cmbListFunctions);
this.cmbListFunctions.$el.find(".listview").focus();
this.cmbListFunctions.scrollToRecord = _.bind(this.onScrollToRecordCustom, this.cmbListFunctions);
}
if (this.functions) {
this.functions.reset();
var i = 0,
length = 0,
functions = null,
group = this.formulasGroups.findWhere({
name: name
});
if (group) {
functions = group.get("functions");
if (functions && functions.length) {
length = functions.length;
for (i = 0; i < length; ++i) {
this.functions.push(new Common.UI.DataViewModel({
id: functions[i].get("index"),
selected: i < 1,
allowSelected: true,
value: functions[i].get("name")
}));
}
this.applyFunction = functions[0].get("name");
this.syntaxLabel.text(this.syntaxText + ": " + this.applyFunction + functions[0].get("args"));
this.cmbListFunctions.scroller.update({
minScrollbarLength: 40,
alwaysVisibleY: true
});
}
}
}
}
},
onKeyDown: function (e, event) {
var i = 0,
record = null,
me = this,
charVal = "",
value = "",
firstRecord = null,
recSelect = false,
innerEl = null,
isEqualSelectRecord = false,
selectRecord = null,
needNextRecord = false;
if (this.disabled) {
return;
}
if (_.isUndefined(undefined)) {
event = e;
}
function selectItem(item) {
me.selectRecord(item);
me.scrollToRecord(item);
innerEl = $(me.el).find(".inner");
me.scroller.scrollTop(innerEl.scrollTop(), 0);
event.preventDefault();
event.stopPropagation();
}
charVal = String.fromCharCode(e.keyCode);
if (e.keyCode > 64 && e.keyCode < 91 && charVal && charVal.length) {
selectRecord = this.store.findWhere({
selected: true
});
if (selectRecord) {
value = selectRecord.get("value");
isEqualSelectRecord = (value && value.length && value[0] === charVal);
}
for (i = 0; i < this.store.length; ++i) {
record = this.store.at(i);
value = record.get("value");
if (value[0] === charVal) {
if (null === firstRecord) {
firstRecord = record;
}
if (isEqualSelectRecord) {
if (selectRecord === record) {
isEqualSelectRecord = false;
}
continue;
}
if (record.get("selected")) {
continue;
}
selectItem(record);
return;
}
}
if (firstRecord) {
selectItem(firstRecord);
return;
}
}
Common.UI.DataView.prototype.onKeyDown.call(this, e, event);
},
onScrollToRecordCustom: function (record) {
var innerEl = $(this.el).find(".inner");
var inner_top = innerEl.offset().top;
var div = innerEl.find("#" + record.get("id")).parent();
var div_top = div.offset().top;
if (div_top < inner_top || div_top + div.height() > inner_top + innerEl.height()) {
if (this.scroller) {
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top, 0);
} else {
innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top);
}
}
},
cancelButtonText: "Cancel",
okButtonText: "Ok",
sCategoryAll: "All",
sCategoryLogical: "Logical",
sCategoryCube: "Cube",
sCategoryDatabase: "Database",
sCategoryDateTime: "Date and time",
sCategoryEngineering: "Engineering",
sCategoryFinancial: "Financial",
sCategoryInformation: "Information",
sCategoryLookupAndReference: "LookupAndReference",
sCategoryMathematics: "Math and trigonometry",
sCategoryStatistical: "Statistical",
sCategoryTextData: "Text and data",
textGroupDescription: "Select Function Group",
textListDescription: "Select Function",
sDescription: "Description",
txtTitle: "Insert Function",
syntaxText: "Syntax"
},
SSE.Views.FormulaDialog || {}));
});

View File

@@ -1,339 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.HyperlinkSettings", {
extend: "Ext.window.Window",
alias: "widget.ssehyperlinksettings",
requires: ["Ext.window.Window", "Ext.form.field.ComboBox", "Ext.form.field.Text", "Ext.Array"],
cls: "asc-advanced-settings-window",
modal: true,
resizable: false,
plain: true,
constrain: true,
height: 348,
width: 366,
layout: {
type: "vbox",
align: "stretch"
},
listeners: {
show: function () {
if (this.contExtLink.isVisible()) {
this.txtLink.focus(false, 500);
} else {
this.txtLinkText.focus(false, 500);
}
}
},
initComponent: function () {
var me = this;
this.addEvents("onmodalresult");
this._spacer = Ext.create("Ext.toolbar.Spacer", {
width: "100%",
height: 10,
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
});
this.cmbLinkType = Ext.widget("combo", {
store: Ext.create("Ext.data.Store", {
fields: ["description", "type"],
data: [{
type: c_oAscHyperlinkType.RangeLink,
description: me.textInternalLink
},
{
type: c_oAscHyperlinkType.WebLink,
description: me.textExternalLink
}]
}),
displayField: "description",
valueField: "type",
queryMode: "local",
editable: false,
listeners: {
change: function (o, nV, oV) {
var isinter = nV == c_oAscHyperlinkType.RangeLink;
me.contIntLink.setVisible(isinter);
me.contExtLink.setVisible(!isinter);
}
}
});
this.cmbSheets = Ext.widget("combo", {
store: Ext.create("Ext.data.ArrayStore", {
fields: ["name"],
data: this.sheets
}),
displayField: "name",
queryMode: "local",
editable: false
});
this.txtDataRange = Ext.widget("textfield", {
allowBlank: false,
check: false,
blankText: me.txtEmpty,
msgTarget: "side",
validator: function (value) {
if (!this.check) {
return true;
}
var isvalid = /^[A-Z]+[1-9]\d*:[A-Z]+[1-9]\d*$/.test(value); ! isvalid && (isvalid = /^[A-Z]+[1-9]\d*$/.test(value));
if (isvalid) {
$("#" + this.id + " input").css("color", "black");
return true;
} else {
$("#" + this.id + " input").css("color", "red");
return me.textInvalidRange;
}
},
listeners: {
blur: function (o) {
this.check = true;
this.check = !this.validate();
}
}
});
this.txtLink = Ext.widget("textfield", {
allowBlank: false,
blankText: me.txtEmpty,
emptyText: me.textEmptyLink,
validateOnChange: false,
msgTarget: "side",
regex: /(([\-\wа-яё]+\.)+[\wа-яё]{2,3}(\/[%\-\wа-яё]+(\.[\wа-яё]{2,})?)*(([\wа-яё\-\.\?\\\/+@&#;`~=%!]*)(\.[\wа-яё]{2,})?)*\/?)/i,
regexText: me.txtNotUrl
});
this.txtLinkText = Ext.widget("textfield", {
allowBlank: false,
blankText: me.txtEmpty,
msgTarget: "side",
emptyText: me.textEmptyDesc
});
this.txtLinkTip = Ext.widget("textfield", {
emptyText: me.textEmptyTooltip
});
this.label = Ext.widget("label", {
width: "100%",
margin: "0 0 3 0"
});
this.contExtLink = Ext.widget("container", {
height: 44,
layout: {
type: "vbox",
align: "stretch"
},
items: [this.label.cloneConfig({
text: me.strLinkTo
}), this.txtLink]
});
this.contIntLink = Ext.widget("container", {
height: 44,
hidden: true,
layout: {
type: "hbox",
align: "stretch"
},
items: [{
xtype: "container",
flex: 1,
layout: {
type: "vbox",
align: "stretch"
},
items: [this.label.cloneConfig({
text: me.strSheet
}), this.cmbSheets]
},
{
xtype: "tbspacer",
width: 18
},
{
xtype: "container",
flex: 1,
layout: {
type: "vbox",
align: "stretch"
},
items: [this.label.cloneConfig({
text: me.strRange
}), this.txtDataRange]
}]
});
this.items = [{
xtype: "container",
height: 254,
padding: "18",
layout: {
type: "vbox",
align: "stretch"
},
items: [this.label.cloneConfig({
text: me.textLinkType
}), this.cmbLinkType, {
xtype: "tbspacer",
height: 10
},
this.contExtLink, this.contIntLink, {
xtype: "tbspacer",
height: 10
},
this.labelDisplay = this.label.cloneConfig({
text: me.strDisplay
}), this.txtLinkText, {
xtype: "tbspacer",
height: 10
},
this.label.cloneConfig({
text: me.textTipText
}), this.txtLinkTip]
},
this._spacer.cloneConfig({
style: "margin: 0 18px"
}), {
xtype: "container",
height: 40,
layout: {
type: "vbox",
align: "center",
pack: "center"
},
items: [{
xtype: "container",
width: 182,
height: 24,
layout: {
type: "hbox",
align: "middle"
},
items: [this.btnOk = Ext.widget("button", {
cls: "asc-blue-button",
width: 86,
height: 22,
margin: "0 5px 0 0",
text: Ext.Msg.buttonText.ok,
listeners: {
click: function (btn) {
if (me.cmbLinkType.getValue() == c_oAscHyperlinkType.RangeLink) {
me.txtDataRange.check = true;
if (!me.txtDataRange.validate()) {
me.txtDataRange.focus(true, 500);
return;
}
} else {
if (!me.txtLink.isValid()) {
me.txtLink.focus(true, 500);
return;
}
}
if (!me.txtLinkText.isValid()) {
me.txtLinkText.focus(true, 500);
return;
}
this.fireEvent("onmodalresult", this, 1);
this.close();
},
scope: this
}
}), this.btnCancel = Ext.widget("button", {
cls: "asc-darkgray-button",
width: 86,
height: 22,
text: me.cancelButtonText,
listeners: {
click: function (btn) {
this.fireEvent("onmodalresult", this, 0);
this.close();
},
scope: this
}
})]
}]
}];
this.callParent(arguments);
this.setTitle(this.textTitle);
},
afterRender: function () {
this.callParent(arguments);
},
setSettings: function (props, text, islock) {
if (!props) {
this.cmbLinkType.select(this.cmbLinkType.getStore().getAt(1));
this.txtLinkText.setValue(text);
} else {
var index = this.cmbLinkType.getStore().find("type", props.asc_getType());
this.cmbLinkType.select(this.cmbLinkType.getStore().getAt(index));
if (props.asc_getType() == c_oAscHyperlinkType.RangeLink) {
index = this.cmbSheets.getStore().find("name", props.asc_getSheet());
if (! (index < 0)) {
this.cmbSheets.select(this.cmbSheets.getStore().getAt(index));
}
this.txtDataRange.setValue(props.asc_getRange());
} else {
this.txtLink.setValue(props.asc_getHyperlinkUrl());
}
this.txtLinkText.setValue(props.asc_getText());
this.txtLinkTip.setValue(props.asc_getTooltip());
}
this.txtLinkText.setDisabled(islock);
this.labelDisplay.setDisabled(islock);
},
getSettings: function () {
var props = new Asc.asc_CHyperlink();
props.asc_setType(this.cmbLinkType.getValue());
if (this.cmbLinkType.getValue() == c_oAscHyperlinkType.RangeLink) {
props.asc_setSheet(this.cmbSheets.getValue());
props.asc_setRange(this.txtDataRange.getValue());
} else {
var url = this.txtLink.getValue().replace(/^\s+|\s+$/g, "");
if (!/(((^https?)|(^ftp)):\/\/)/i.test(url)) {
url = "http://" + url;
}
props.asc_setHyperlinkUrl(url);
}
props.asc_setText(this.txtLinkText.isDisabled() ? null : this.txtLinkText.getValue());
props.asc_setTooltip(this.txtLinkTip.getValue());
return props;
},
textTitle: "Hyperlink Settings",
textInternalLink: "Internal Data Range",
textExternalLink: "Web Link",
textEmptyLink: "Enter link here",
textEmptyDesc: "Enter caption here",
textEmptyTooltip: "Enter tooltip here",
strSheet: "Sheet",
strRange: "Range",
textLinkType: "Link Type",
strDisplay: "Display",
textTipText: "Screen Tip Text",
strLinkTo: "Link To",
txtEmpty: "This field is required",
textInvalidRange: "ERROR! Invalid cells range",
txtNotUrl: 'This field should be a URL in the format "http://www.example.com"',
cancelButtonText: "Cancel"
});

View File

@@ -0,0 +1,245 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
define(["common/main/lib/util/utils", "common/main/lib/component/ComboBox", "common/main/lib/component/InputField", "common/main/lib/component/Window"], function () {
SSE.Views.HyperlinkSettingsDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
style: "min-width: 230px;",
cls: "modal-dlg"
},
initialize: function (options) {
_.extend(this.options, {
title: this.textTitle
},
options || {});
this.template = ['<div class="box">', '<div class="input-row">', "<label>" + this.textLinkType + "</label>", "</div>", '<div class="input-row" id="id-dlg-hyperlink-type" style="margin-bottom: 5px;">', "</div>", '<div id="id-dlg-hyperlink-external">', '<div class="input-row">', "<label>" + this.strLinkTo + " *</label>", "</div>", '<div id="id-dlg-hyperlink-url" class="input-row" style="margin-bottom: 5px;"></div>', "</div>", '<div id="id-dlg-hyperlink-internal" style="display: none;">', '<div class="input-row">', '<label style="width: 50%;">' + this.strSheet + "</label>", '<label style="width: 50%;">' + this.strRange + " *</label>", "</div>", '<div class="input-row" style="margin-bottom: 5px;">', '<div id="id-dlg-hyperlink-sheet" style="display: inline-block; width: 50%; padding-right: 10px; float: left;"></div>', '<div id="id-dlg-hyperlink-range" style="display: inline-block; width: 50%;"></div>', "</div>", "</div>", '<div class="input-row">', "<label>" + this.strDisplay + "</label>", "</div>", '<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>', '<div class="input-row">', "<label>" + this.textTipText + "</label>", "</div>", '<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>', "</div>", '<div class="footer right">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + "</button>", '<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + "</button>", "</div>"].join("");
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild(),
me = this;
me.cmbLinkType = new Common.UI.ComboBox({
el: $("#id-dlg-hyperlink-type"),
cls: "input-group-nr",
editable: false,
menuStyle: "min-width: 100%;",
data: [{
displayValue: this.textInternalLink,
value: c_oAscHyperlinkType.RangeLink
},
{
displayValue: this.textExternalLink,
value: c_oAscHyperlinkType.WebLink
}]
}).on("selected", function (combo, record) {
$("#id-dlg-hyperlink-external")[record.value == c_oAscHyperlinkType.WebLink ? "show" : "hide"]();
$("#id-dlg-hyperlink-internal")[record.value != c_oAscHyperlinkType.WebLink ? "show" : "hide"]();
});
me.cmbLinkType.setValue(c_oAscHyperlinkType.WebLink);
me.cmbSheets = new Common.UI.ComboBox({
el: $("#id-dlg-hyperlink-sheet"),
cls: "input-group-nr",
editable: false,
menuStyle: "min-width: 100%;max-height: 150px;"
});
me.inputUrl = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-url"),
allowBlank: false,
blankError: me.txtEmpty,
validateOnBlur: false,
style: "width: 100%;",
validation: function (value) {
me.isEmail = false;
var isvalid = value.strongMatch(Common.Utils.hostnameRe); ! isvalid && (me.isEmail = isvalid = value.strongMatch(Common.Utils.emailRe)); ! isvalid && (isvalid = value.strongMatch(Common.Utils.ipRe)); ! isvalid && (isvalid = value.strongMatch(Common.Utils.localRe));
if (isvalid) {
return true;
} else {
return me.txtNotUrl;
}
}
});
me.inputRange = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-range"),
allowBlank: false,
blankError: me.txtEmpty,
style: "width: 100%;",
validateOnChange: true,
validateOnBlur: false,
validation: function (value) {
var isvalid = /^[A-Z]+[1-9]\d*:[A-Z]+[1-9]\d*$/.test(value);
if (!isvalid) {
isvalid = /^[A-Z]+[1-9]\d*$/.test(value);
}
if (isvalid) {
return true;
} else {
return me.textInvalidRange;
}
}
});
me.inputDisplay = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-display"),
allowBlank: true,
validateOnBlur: false,
style: "width: 100%;"
});
me.inputTip = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-tip"),
style: "width: 100%;"
});
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
$window.find("input").on("keypress", _.bind(this.onKeyPress, this));
},
show: function () {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function () {
if (me.focusedInput) {
me.focusedInput.focus();
}
},
500);
},
setSettings: function (settings) {
if (settings) {
var me = this;
this.cmbSheets.setData(settings.sheets);
if (!settings.props) {
this.cmbLinkType.setValue(c_oAscHyperlinkType.WebLink);
this.cmbLinkType.setDisabled(!settings.allowInternal);
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.text);
this.focusedInput = this.inputUrl.cmpEl.find("input");
this.cmbSheets.setValue(settings.currentSheet);
} else {
this.cmbLinkType.setValue(settings.props.asc_getType());
this.cmbLinkType.setDisabled(!settings.allowInternal);
if (settings.props.asc_getType() == c_oAscHyperlinkType.RangeLink) {
$("#id-dlg-hyperlink-external").hide();
$("#id-dlg-hyperlink-internal").show();
this.cmbSheets.setValue(settings.props.asc_getSheet());
this.inputRange.setValue(settings.props.asc_getRange());
this.focusedInput = this.inputRange.cmpEl.find("input");
} else {
this.inputUrl.setValue(settings.props.asc_getHyperlinkUrl());
this.focusedInput = this.inputUrl.cmpEl.find("input");
this.cmbSheets.setValue(settings.currentSheet);
}
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.props.asc_getText());
this.inputTip.setValue(settings.props.asc_getTooltip());
}
this.inputDisplay.setDisabled(settings.isLock);
}
},
getSettings: function () {
var props = new Asc.asc_CHyperlink(),
def_display = "";
props.asc_setType(this.cmbLinkType.getValue());
if (this.cmbLinkType.getValue() == c_oAscHyperlinkType.RangeLink) {
props.asc_setSheet(this.cmbSheets.getValue());
props.asc_setRange(this.inputRange.getValue());
def_display = this.cmbSheets.getValue() + "!" + this.inputRange.getValue();
} else {
var url = this.inputUrl.getValue().replace(/^\s+|\s+$/g, "");
if (!/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url)) {
url = ((this.isEmail) ? "mailto:": "http://") + url;
}
props.asc_setHyperlinkUrl(url);
def_display = url;
}
if (this.inputDisplay.isDisabled()) {
props.asc_setText(null);
} else {
if (_.isEmpty(this.inputDisplay.getValue())) {
this.inputDisplay.setValue(def_display);
}
props.asc_setText(this.inputDisplay.getValue());
}
props.asc_setTooltip(this.inputTip.getValue());
return props;
},
onBtnClick: function (event) {
this._handleInput(event.currentTarget.attributes["result"].value);
},
onKeyPress: function (event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput("ok");
return false;
}
},
_handleInput: function (state) {
if (this.options.handler) {
if (state == "ok") {
var checkurl = (this.cmbLinkType.getValue() === c_oAscHyperlinkType.WebLink) ? this.inputUrl.checkValidate() : true,
checkrange = (this.cmbLinkType.getValue() === c_oAscHyperlinkType.RangeLink) ? this.inputRange.checkValidate() : true,
checkdisp = this.inputDisplay.checkValidate();
if (checkurl !== true) {
this.inputUrl.cmpEl.find("input").focus();
return;
}
if (checkrange !== true) {
this.inputRange.cmpEl.find("input").focus();
return;
}
if (checkdisp !== true) {
this.inputDisplay.cmpEl.find("input").focus();
return;
}
}
this.options.handler.call(this, this, state);
}
this.close();
},
textTitle: "Hyperlink Settings",
textInternalLink: "Internal Data Range",
textExternalLink: "Web Link",
textEmptyLink: "Enter link here",
textEmptyDesc: "Enter caption here",
textEmptyTooltip: "Enter tooltip here",
strSheet: "Sheet",
strRange: "Range",
textLinkType: "Link Type",
strDisplay: "Display",
textTipText: "Screen Tip Text",
strLinkTo: "Link To",
txtEmpty: "This field is required",
textInvalidRange: "ERROR! Invalid cells range",
txtNotUrl: 'This field should be a URL in the format "http://www.example.com"',
cancelButtonText: "Cancel",
textDefault: "Selected range"
},
SSE.Views.HyperlinkSettingsDialog || {}));
});

View File

@@ -1,389 +1,259 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.ImageSettings", {
extend: "Common.view.AbstractSettingsPanel",
alias: "widget.sseimagesettings",
height: 192,
requires: ["Ext.ComponentQuery", "Ext.container.Container", "Ext.button.Button", "Ext.form.Label", "Ext.toolbar.Spacer", "Common.view.ImageFromUrlDialog", "Ext.util.Cookies"],
constructor: function (config) {
this.callParent(arguments);
this.initConfig(config);
return this;
},
initComponent: function () {
this.title = this.txtTitle;
this._initSettings = true;
this._nRatio = 1;
this._state = {
Width: 0,
Height: 0
};
this._spnWidth = Ext.create("Common.component.MetricSpinner", {
id: "image-spin-width",
readOnly: false,
maxValue: 55.88,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "3 cm",
width: 78,
listeners: {
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
var w = field.getNumberValue();
var h = this._spnHeight.getNumberValue();
if (this._btnRatio.pressed) {
h = w / this._nRatio;
if (h > this._spnHeight.maxValue) {
h = this._spnHeight.maxValue;
w = h * this._nRatio;
this._spnWidth.suspendEvents(false);
this._spnWidth.setValue(w);
this._spnWidth.resumeEvents();
}
this._spnHeight.suspendEvents(false);
this._spnHeight.setValue(h);
this._spnHeight.resumeEvents();
}
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putWidth(Common.MetricSettings.fnRecalcToMM(w));
props.asc_putHeight(Common.MetricSettings.fnRecalcToMM(h));
this.api.asc_setGraphicObjectProps(props);
}
this.fireEvent("editcomplete", this);
},
this)
}
});
this.controls.push(this._spnWidth);
this._spnHeight = Ext.create("Common.component.MetricSpinner", {
id: "image-span-height",
readOnly: false,
maxValue: 55.88,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "3 cm",
width: 78,
listeners: {
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
var h = field.getNumberValue(),
w = this._spnWidth.getNumberValue();
if (this._btnRatio.pressed) {
w = h * this._nRatio;
if (w > this._spnWidth.maxValue) {
w = this._spnWidth.maxValue;
h = w / this._nRatio;
this._spnHeight.suspendEvents(false);
this._spnHeight.setValue(h);
this._spnHeight.resumeEvents();
}
this._spnWidth.suspendEvents(false);
this._spnWidth.setValue(w);
this._spnWidth.resumeEvents();
}
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putWidth(Common.MetricSettings.fnRecalcToMM(w));
props.asc_putHeight(Common.MetricSettings.fnRecalcToMM(h));
this.api.asc_setGraphicObjectProps(props);
}
this.fireEvent("editcomplete", this);
},
this)
}
});
this.controls.push(this._spnHeight);
var value = window.localStorage.getItem("sse-settings-imageratio");
this._btnRatio = Ext.create("Ext.Button", {
id: "image-button-ratio",
iconCls: "advanced-btn-ratio",
enableToggle: true,
width: 22,
height: 22,
pressed: (value === null || parseInt(value) == 1),
style: "margin: 0 0 0 4px;",
tooltip: this.textKeepRatio,
toggleHandler: Ext.bind(function (btn) {
if (btn.pressed && this._spnHeight.getNumberValue() > 0) {
this._nRatio = this._spnWidth.getNumberValue() / this._spnHeight.getNumberValue();
}
window.localStorage.setItem("sse-settings-imageratio", (btn.pressed) ? 1 : 0);
},
this)
});
this._btnOriginalSize = Ext.create("Ext.Button", {
id: "image-button-original-size",
text: this.textOriginalSize,
width: 106,
listeners: {
click: this.setOriginalSize,
scope: this
}
});
this._btnInsertFromFile = Ext.create("Ext.Button", {
id: "image-button-from-file",
text: this.textFromFile,
width: 85,
listeners: {
click: function (btn) {
if (this.api) {
this.api.asc_changeImageFromFile();
}
this.fireEvent("editcomplete", this);
},
scope: this
}
});
this._btnInsertFromUrl = Ext.create("Ext.Button", {
id: "image-button-from-url",
text: this.textFromUrl,
width: 85,
listeners: {
click: function (btn) {
var w = Ext.create("Common.view.ImageFromUrlDialog");
w.addListener("onmodalresult", Ext.bind(this._onOpenImageFromURL, [this, w]), false);
w.addListener("close", Ext.bind(function (cnt, eOpts) {
this.fireEvent("editcomplete", this);
},
this));
w.show();
},
scope: this
}
});
this._SizePanel = Ext.create("Ext.container.Container", {
layout: "vbox",
layoutConfig: {
align: "stretch"
},
height: 88,
width: 195,
items: [{
xtype: "tbspacer",
height: 8
},
{
xtype: "container",
layout: {
type: "table",
columns: 2
},
defaults: {
xtype: "container",
layout: "vbox",
layoutConfig: {
align: "stretch"
},
height: 43,
style: "float:left;"
},
items: [{
items: [{
xtype: "label",
text: this.textWidth,
width: 78
},
{
xtype: "tbspacer",
height: 3
},
{
xtype: "container",
width: 108,
layout: {
type: "hbox"
},
items: [this._spnWidth, this._btnRatio, {
xtype: "tbspacer",
width: 4
}]
}]
},
{
items: [{
xtype: "label",
text: this.textHeight,
width: 78
},
{
xtype: "tbspacer",
height: 3
},
this._spnHeight]
}]
},
{
xtype: "tbspacer",
height: 7
},
this._btnOriginalSize, {
xtype: "tbspacer",
height: 3
}]
});
this._UrlPanel = Ext.create("Ext.container.Container", {
layout: "vbox",
layoutConfig: {
align: "stretch"
},
height: 36,
width: 195,
items: [{
xtype: "tbspacer",
height: 8
},
{
xtype: "container",
layout: {
type: "table",
columns: 2,
tdAttrs: {
style: "padding-right: 8px;"
}
},
items: [this._btnInsertFromFile, this._btnInsertFromUrl]
},
{
xtype: "tbspacer",
height: 2
}]
});
this.items = [{
xtype: "tbspacer",
height: 9
},
{
xtype: "label",
style: "font-weight: bold;margin-top: 1px;",
text: this.textSize
},
this._SizePanel, {
xtype: "tbspacer",
height: 5
},
{
xtype: "tbspacer",
width: "100%",
height: 10,
style: "padding-right: 10px;",
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
},
{
xtype: "label",
style: "font-weight: bold;margin-top: 1px;",
text: this.textInsert
},
this._UrlPanel];
this.addEvents("editcomplete");
this.callParent(arguments);
},
setOriginalSize: function () {
if (this.api) {
var imgsize = this.api.asc_getOriginalImageSize();
if (imgsize) {
var w = imgsize.asc_getImageWidth();
var h = imgsize.asc_getImageHeight();
var properties = new Asc.asc_CImgProperty();
properties.asc_putWidth(w);
properties.asc_putHeight(h);
this.api.asc_setGraphicObjectProps(properties);
}
this.fireEvent("editcomplete", this);
}
},
setApi: function (api) {
if (api == undefined) {
return;
}
this.api = api;
},
ChangeSettings: function (props) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
if (props) {
this.SuspendEvents();
var value = props.asc_getWidth();
if (Math.abs(this._state.Width - value) > 0.001 || (this._state.Width === null || value === null) && (this._state.Width !== value)) {
this._spnWidth.setValue((value !== null) ? Common.MetricSettings.fnRecalcFromMM(value) : "");
this._state.Width = value;
}
value = props.asc_getHeight();
if (Math.abs(this._state.Height - value) > 0.001 || (this._state.Height === null || value === null) && (this._state.Height !== value)) {
this._spnHeight.setValue((value !== null) ? Common.MetricSettings.fnRecalcFromMM(value) : "");
this._state.Height = value;
}
this.ResumeEvents();
if (props.asc_getHeight() > 0) {
this._nRatio = props.asc_getWidth() / props.asc_getHeight();
}
this._btnOriginalSize.setDisabled(props.asc_getImageUrl() === null || props.asc_getImageUrl() === undefined);
}
},
_onOpenImageFromURL: function (mr) {
var self = this[0];
var url = this[1].txtUrl;
if (mr == 1 && self.api) {
var checkurl = url.value.replace(/ /g, "");
if (checkurl != "") {
var props = new Asc.asc_CImgProperty();
props.asc_putImageUrl(url.value);
self.api.asc_setGraphicObjectProps(props);
}
}
},
updateMetricUnit: function () {
var spinners = this.query("commonmetricspinner");
if (spinners) {
for (var i = 0; i < spinners.length; i++) {
var spinner = spinners[i];
spinner.setDefaultUnit(Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
spinner.setStep(Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
createDelayedElements: function () {
this.updateMetricUnit();
},
textKeepRatio: "Constant Proportions",
textSize: "Size",
textWidth: "Width",
textHeight: "Height",
textOriginalSize: "Default Size",
textUrl: "Image URL",
textInsert: "Change Image",
textFromUrl: "From URL",
textFromFile: "From File",
txtTitle: "Picture"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/ImageSettings.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/component/MetricSpinner", "common/main/lib/view/ImageFromUrlDialog"], function (menuTemplate, $, _, Backbone) {
SSE.Views.ImageSettings = Backbone.View.extend(_.extend({
el: "#id-image-settings",
template: _.template(menuTemplate),
events: {},
options: {
alias: "ImageSettings"
},
initialize: function () {
var me = this;
this._initSettings = true;
this._nRatio = 1;
this._state = {
Width: 0,
Height: 0,
DisabledControls: false
};
this.spinners = [];
this.lockedControls = [];
this._locked = false;
this._noApply = false;
this.render();
this.spnWidth = new Common.UI.MetricSpinner({
el: $("#image-spin-width"),
step: 0.1,
width: 78,
defaultUnit: "cm",
value: "3 cm",
maxValue: 55.88,
minValue: 0
});
this.spinners.push(this.spnWidth);
this.lockedControls.push(this.spnWidth);
this.spnHeight = new Common.UI.MetricSpinner({
el: $("#image-spin-height"),
step: 0.1,
width: 78,
defaultUnit: "cm",
value: "3 cm",
maxValue: 55.88,
minValue: 0
});
this.spinners.push(this.spnHeight);
this.lockedControls.push(this.spnHeight);
this.btnRatio = new Common.UI.Button({
cls: "btn-toolbar btn-toolbar-default",
iconCls: "advanced-btn-ratio",
style: "margin-bottom: 1px;",
enableToggle: true,
hint: this.textKeepRatio
});
this.btnRatio.render($("#image-button-ratio"));
this.lockedControls.push(this.btnRatio);
var value = window.localStorage.getItem("sse-settings-imageratio");
if (value === null || parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
this.btnRatio.on("click", _.bind(function (btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue() > 0) {
this._nRatio = this.spnWidth.getNumberValue() / this.spnHeight.getNumberValue();
}
window.localStorage.setItem("sse-settings-imageratio", (btn.pressed) ? 1 : 0);
},
this));
this.btnOriginalSize = new Common.UI.Button({
el: $("#image-button-original-size")
});
this.lockedControls.push(this.btnOriginalSize);
this.btnInsertFromFile = new Common.UI.Button({
el: $("#image-button-from-file")
});
this.lockedControls.push(this.btnInsertFromFile);
this.btnInsertFromUrl = new Common.UI.Button({
el: $("#image-button-from-url")
});
this.lockedControls.push(this.btnInsertFromUrl);
this.spnWidth.on("change", _.bind(this.onWidthChange, this));
this.spnHeight.on("change", _.bind(this.onHeightChange, this));
this.btnOriginalSize.on("click", _.bind(this.setOriginalSize, this));
this.btnInsertFromFile.on("click", _.bind(function (btn) {
if (this.api) {
this.api.asc_changeImageFromFile();
}
Common.NotificationCenter.trigger("edit:complete", this);
},
this));
this.btnInsertFromUrl.on("click", _.bind(this.insertFromUrl, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
scope: this
}));
},
setApi: function (api) {
if (api == undefined) {
return;
}
this.api = api;
return this;
},
updateMetricUnit: function () {
if (this.spinners) {
for (var i = 0; i < this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
createDelayedElements: function () {
this.updateMetricUnit();
},
ChangeSettings: function (props) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
this.disableControls(this._locked);
if (props) {
var value = props.asc_getWidth();
if (Math.abs(this._state.Width - value) > 0.001 || (this._state.Width === null || value === null) && (this._state.Width !== value)) {
this.spnWidth.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : "", true);
this._state.Width = value;
}
value = props.asc_getHeight();
if (Math.abs(this._state.Height - value) > 0.001 || (this._state.Height === null || value === null) && (this._state.Height !== value)) {
this.spnHeight.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : "", true);
this._state.Height = value;
}
if (props.asc_getHeight() > 0) {
this._nRatio = props.asc_getWidth() / props.asc_getHeight();
}
this.btnOriginalSize.setDisabled(props.asc_getImageUrl() === null || props.asc_getImageUrl() === undefined || this._locked);
}
},
onWidthChange: function (field, newValue, oldValue, eOpts) {
var w = field.getNumberValue();
var h = this.spnHeight.getNumberValue();
if (this.btnRatio.pressed) {
h = w / this._nRatio;
if (h > this.spnHeight.options.maxValue) {
h = this.spnHeight.options.maxValue;
w = h * this._nRatio;
this.spnWidth.setValue(w, true);
}
this.spnHeight.setValue(h, true);
}
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w));
props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h));
this.api.asc_setGraphicObjectProps(props);
}
Common.NotificationCenter.trigger("edit:complete", this);
},
onHeightChange: function (field, newValue, oldValue, eOpts) {
var h = field.getNumberValue(),
w = this.spnWidth.getNumberValue();
if (this.btnRatio.pressed) {
w = h * this._nRatio;
if (w > this.spnWidth.options.maxValue) {
w = this.spnWidth.options.maxValue;
h = w / this._nRatio;
this.spnHeight.setValue(h, true);
}
this.spnWidth.setValue(w, true);
}
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w));
props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h));
this.api.asc_setGraphicObjectProps(props);
}
Common.NotificationCenter.trigger("edit:complete", this);
},
setOriginalSize: function () {
if (this.api) {
var imgsize = this.api.asc_getOriginalImageSize();
var w = imgsize.asc_getImageWidth();
var h = imgsize.asc_getImageHeight();
var properties = new Asc.asc_CImgProperty();
properties.asc_putWidth(w);
properties.asc_putHeight(h);
this.api.asc_setGraphicObjectProps(properties);
Common.NotificationCenter.trigger("edit:complete", this);
}
},
insertFromUrl: function () {
var me = this;
(new Common.Views.ImageFromUrlDialog({
handler: function (result, value) {
if (result == "ok") {
if (me.api) {
var checkUrl = value.replace(/ /g, "");
if (!_.isEmpty(checkUrl)) {
var props = new Asc.asc_CImgProperty();
props.asc_putImageUrl(checkUrl);
me.api.asc_setGraphicObjectProps(props);
}
}
}
Common.NotificationCenter.trigger("edit:complete", me);
}
})).show();
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function (disable) {
if (this._state.DisabledControls !== disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function (item) {
item.setDisabled(disable);
});
}
},
textKeepRatio: "Constant Proportions",
textSize: "Size",
textWidth: "Width",
textHeight: "Height",
textOriginalSize: "Default Size",
textInsert: "Insert Image",
textFromUrl: "From URL",
textFromFile: "From File"
},
SSE.Views.ImageSettings || {}));
});

View File

@@ -0,0 +1,253 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/LeftMenu.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/view/About", "common/main/lib/view/Comments", "common/main/lib/view/Chat", "common/main/lib/view/SearchDialog", "spreadsheeteditor/main/app/view/FileMenu"], function (menuTemplate, $, _, Backbone) {
var SCALE_MIN = 40;
var MENU_SCALE_PART = 300;
SSE.Views.LeftMenu = Backbone.View.extend(_.extend({
el: "#left-menu",
template: _.template(menuTemplate),
events: function () {
return {
"click #left-btn-support": function () {
window.open("http://feedback.onlyoffice.com/");
},
"click #left-btn-comments": _.bind(this.onCoauthOptions, this),
"click #left-btn-chat": _.bind(this.onCoauthOptions, this)
};
},
initialize: function () {
this.minimizedMode = true;
},
render: function () {
var el = $(this.el);
el.html(this.template({}));
this.btnFile = new Common.UI.Button({
action: "file",
el: $("#left-btn-file", this.el),
hint: this.tipFile + Common.Utils.String.platformKey("Alt+F"),
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnSearch = new Common.UI.Button({
action: "search",
el: $("#left-btn-search", this.el),
hint: this.tipSearch + Common.Utils.String.platformKey("Ctrl+F"),
disabled: true,
enableToggle: true
});
this.btnAbout = new Common.UI.Button({
action: "about",
el: $("#left-btn-about", this.el),
hint: this.tipAbout,
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnSupport = new Common.UI.Button({
action: "support",
el: $("#left-btn-support", this.el),
hint: this.tipSupport,
disabled: true
});
this.btnComments = new Common.UI.Button({
el: $("#left-btn-comments", this.el),
hint: this.tipComments + Common.Utils.String.platformKey("Ctrl+Shift+H"),
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnChat = new Common.UI.Button({
el: $("#left-btn-chat", this.el),
hint: this.tipChat + Common.Utils.String.platformKey("Ctrl+Alt+Q", null, function (string) {
return Common.Utils.isMac ? string.replace(/Ctrl|ctrl/g, "⌃") : string;
}),
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnComments.hide();
this.btnChat.hide();
this.btnComments.on("click", _.bind(this.onBtnMenuClick, this));
this.btnChat.on("click", _.bind(this.onBtnMenuClick, this));
this.btnSearch.on("click", _.bind(this.onBtnMenuClick, this));
this.btnAbout.on("toggle", _.bind(this.onBtnMenuToggle, this));
this.btnFile.on("toggle", _.bind(this.onBtnMenuToggle, this));
var menuFile = new SSE.Views.FileMenu({});
menuFile.options = {
alias: "FileMenu"
};
this.btnFile.panel = menuFile.render();
this.btnAbout.panel = (new Common.Views.About({
el: $("#about-menu-panel"),
appName: "Spreadsheet Editor"
})).render();
return this;
},
onBtnMenuToggle: function (btn, state) {
if (state) {
this.btnFile.pressed && this.fireEvent("file:show", this);
btn.panel["show"]();
this.$el.width(SCALE_MIN);
if (this.btnSearch.isActive()) {
this.btnSearch.toggle(false);
}
} else {
(this.btnFile.id == btn.id) && this.fireEvent("file:hide", this);
btn.panel["hide"]();
}
if (this.mode.isEdit) {
SSE.getController("Toolbar").DisableToolbar(state == true);
}
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
},
onBtnMenuClick: function (btn, e) {
this.btnFile.toggle(false);
this.btnAbout.toggle(false);
if (btn.options.action == "search") {} else {
if (btn.pressed) {
if (! (this.$el.width() > SCALE_MIN)) {
this.$el.width(localStorage.getItem("sse-mainmenu-width") || MENU_SCALE_PART);
}
} else {
localStorage.setItem("sse-mainmenu-width", this.$el.width());
this.$el.width(SCALE_MIN);
}
}
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
},
onCoauthOptions: function (e) {
if (this.mode.canCoAuthoring) {
this.panelComments[this.btnComments.pressed ? "show" : "hide"]();
this.fireEvent((this.btnComments.pressed) ? "comments:show": "comments:hide", this);
if (this.btnChat.pressed) {
if (this.btnChat.$el.hasClass("notify")) {
this.btnChat.$el.removeClass("notify");
}
this.panelChat.show();
this.panelChat.focus();
} else {
this.panelChat["hide"]();
}
}
},
setOptionsPanel: function (name, panel) {
if (name == "chat") {
this.panelChat = panel.render("#left-panel-chat");
} else {
if (name == "comment") {
this.panelComments = panel;
}
}
},
markCoauthOptions: function (opt) {
if (this.btnChat.isVisible() && !this.btnChat.isDisabled() && !this.btnChat.pressed) {
this.btnChat.$el.addClass("notify");
}
},
close: function (menu) {
this.btnFile.toggle(false);
this.btnAbout.toggle(false);
this.$el.width(SCALE_MIN);
if (this.mode.canCoAuthoring) {
this.panelComments["hide"]();
this.panelChat["hide"]();
if (this.btnComments.pressed) {
this.fireEvent("comments:hide", this);
}
this.btnComments.toggle(false, true);
this.btnChat.toggle(false, true);
}
},
isOpened: function () {
var isopened = this.btnFile.pressed || this.btnSearch.pressed; ! isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed);
return isopened;
},
disableMenu: function (menu, disable) {
this.btnFile.setDisabled(false);
this.btnAbout.setDisabled(false);
this.btnSupport.setDisabled(false);
this.btnSearch.setDisabled(false);
this.btnComments.setDisabled(false);
this.btnChat.setDisabled(false);
},
showMenu: function (menu) {
var re = /^(\w+):?(\w*)$/.exec(menu);
if (re[1] == "file") {
if (!this.btnFile.pressed) {
this.btnFile.toggle(true);
this.btnFile.$el.focus();
}
this.btnFile.panel.show(re[2].length ? re[2] : undefined);
} else {
if (menu == "chat") {
if (this.btnChat.isVisible() && !this.btnChat.isDisabled() && !this.btnChat.pressed) {
this.btnChat.toggle(true);
this.onBtnMenuClick(this.btnChat);
this.onCoauthOptions();
this.panelChat.focus();
}
} else {
if (menu == "comments") {
if (this.btnComments.isVisible() && !this.btnComments.isDisabled() && !this.btnComments.pressed) {
this.btnComments.toggle(true);
this.onBtnMenuClick(this.btnComments);
this.onCoauthOptions();
this.btnComments.$el.focus();
}
}
}
}
},
getMenu: function (type) {
switch (type) {
case "file":
return this.btnFile.panel;
case "about":
return this.btnAbout.panel;
default:
return null;
}
},
setMode: function (mode) {
this.mode = mode;
return this;
},
tipComments: "Comments",
tipChat: "Chat",
tipAbout: "About",
tipSupport: "Feedback & Support",
tipFile: "File",
tipSearch: "Search"
},
SSE.Views.LeftMenu || {}));
});

View File

@@ -1,358 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var SCALE_MIN = 40;
var SCALE_FULL = "100%";
var SCALE_PART = 300;
var MAINMENU_TOOLBAR_ID = "mainmenu-toolbar-id";
var MAINMENU_PANEL_ID = "mainmenu-panel-id";
var MAINMENU_FULL_PANEL_ID = "mainmenu-full-panel-id";
Ext.define("SSE.view.MainMenu", {
extend: "Ext.panel.Panel",
alias: "widget.ssemainmenu",
requires: ["Ext.toolbar.Toolbar", "Ext.button.Button", "Ext.container.Container", "Ext.toolbar.Spacer"],
cls: "lm-style",
id: MAINMENU_PANEL_ID,
bodyCls: "lm-body",
width: SCALE_MIN,
layout: "card",
currentFullScaleMenuBtn: undefined,
fullScaledItemCnt: undefined,
buttonCollection: [],
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
listeners: {
afterrender: function () {
var owner = this.ownerCt;
if (Ext.isDefined(owner)) {
owner.addListener("resize", Ext.bind(this.resizeMenu, this));
}
}
},
initComponent: function () {
this.items = [];
this.dockedItems = this.buildDockedItems();
this.addEvents("panelshow", "panelhide");
this.callParent(arguments);
},
buildDockedItems: function () {
var addedButtons = [],
item,
cardId,
config;
var me = this;
for (var i = 0; i < this.buttonCollection.length; i++) {
item = this.buttonCollection[i];
cardId = -1;
config = {
xtype: "button",
id: item.id,
itemScale: item.scale,
tooltip: item.tooltip,
disabled: item.disabled === true,
cls: "asc-main-menu-buttons",
iconCls: "asc-main-menu-btn " + item.cls,
style: "margin-bottom: 8px;"
};
if (item.scale == "modal") {
config.enableToggle = true;
config.listeners = item.listeners;
config.getApi = function () {
return me.api;
};
} else {
config.isFullScale = item.scale == "full";
config.bodyItems = item.items;
config.toggleGroup = "tbMainMenu";
config.listeners = {
click: function (btnCall) {
if (btnCall.pressed) {
me.openButtonMenu(btnCall);
}
},
toggle: function (btnCall, pressed) {
btnCall[pressed ? "addCls" : "removeCls"]("asc-main-menu-btn-selected");
if (!pressed) {
me.fireEvent("panelbeforehide");
if (btnCall.isFullScale) {
if (Ext.isDefined(me.fullScaledItemCnt) && me.fullScaledItemCnt.isVisible()) {
me.fullScaledItemCnt.hide();
me.currentFullScaleMenuBtn = undefined;
}
var panel = me.fullScaledItemCnt;
} else {
window.localStorage.setItem("sse-mainmenu-width", me.getWidth());
panel = Ext.getCmp(btnCall.bodyCardId);
me.setWidth(SCALE_MIN);
}
me.fireEvent("panelhide", panel, btnCall.isFullScale);
}
}
};
}
addedButtons.push(config);
}
this.mainToolbar = Ext.create("Ext.toolbar.Toolbar", {
cls: "lm-default-toolbar",
width: this.width || SCALE_MIN,
vertical: true,
dock: "left",
defaultType: "button",
items: addedButtons,
style: "padding-top:15px;",
listeners: {
afterrender: function (cmp) {
cmp.getEl().on("keydown", me._onMenuKeyDown, me, {
button: undefined
});
}
}
});
return this.mainToolbar;
},
closeFullScaleMenu: function () {
if (Ext.isDefined(this.currentFullScaleMenuBtn)) {
this.currentFullScaleMenuBtn.toggle(false);
}
},
openButtonMenu: function (btn) {
this.fireEvent("panelbeforeshow", btn.isFullScale);
if (Ext.isNumber(btn.itemScale)) {
var saved_width = window.localStorage.getItem("sse-mainmenu-width");
saved_width = saved_width ? parseInt(saved_width) : btn.itemScale;
this.setSize({
width: saved_width
});
} else {
this.setWidth(btn.isFullScale ? SCALE_MIN : SCALE_PART);
}
if (btn.isFullScale) {
var ownerEl = this.ownerCt.el;
var startPos = ownerEl.getXY();
var panel = this.fullScaledItemCnt;
this.currentFullScaleMenuBtn = btn;
this.fullScaledItemCnt.setSize(ownerEl.getWidth() - SCALE_MIN, ownerEl.getHeight());
this.fullScaledItemCnt.setPosition(startPos[0] + this.width, startPos[1]);
this.fullScaledItemCnt.show();
this.fullScaledItemCnt.getLayout().setActiveItem(Ext.getCmp(btn.bodyCardId));
} else {
panel = Ext.getCmp(btn.bodyCardId);
this.getLayout().setActiveItem(btn.bodyCardId);
}
btn.removeCls("notify");
this.fireEvent("panelshow", panel, btn.isFullScale);
this.doComponentLayout();
Common.component.Analytics.trackEvent("Main Menu", btn.tooltip);
},
resizeMenu: function (Component, adjWidth, adjHeight, eOpts) {
if (Ext.isDefined(this.fullScaledItemCnt) && this.fullScaledItemCnt.isVisible()) {
var ownerEl = this.ownerCt.el;
var startPos = ownerEl.getXY();
this.fullScaledItemCnt.setSize(adjWidth - SCALE_MIN, adjHeight);
this.fullScaledItemCnt.setPosition(startPos[0] + this.width, startPos[1]);
} else {
for (var i = 0; i < this.items.length; i++) {
var h = this.items.items[i].getHeight();
if (adjHeight != h) {
this.items.items[i].setHeight(adjHeight);
}
}
}
this.doComponentLayout();
},
setApi: function (o) {
this.api = o;
this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage", Ext.bind(this.onCoAuthoringChatReceiveMessage, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
this.api.asc_registerCallback("asc_onGetLicense", Ext.bind(this.onGetLicense, this));
return this;
},
selectMenu: function (clsname) {
var btnCall, btn, i, panel;
var tbMain = this.mainToolbar;
for (i = tbMain.items.length; i > 0; i--) {
btnCall = tbMain.items.items[i - 1];
if (btnCall.iconCls && !(btnCall.iconCls.search(clsname) < 0)) {
break;
} else {
btnCall = undefined;
}
}
if (btnCall && !btnCall.pressed) {
if (Ext.isDefined(tbMain)) {
for (i = 0; i < tbMain.items.length; i++) {
btn = tbMain.items.items[i];
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
if (btn.id != btnCall.id && btn.pressed) {
btn.toggle(false);
}
}
}
}
btnCall.toggle(true);
if (btnCall.itemScale != "modal") {
this.openButtonMenu(btnCall);
}
}
},
clearSelection: function (exclude) {
var btn, i;
var tbMain = this.mainToolbar;
if (Ext.isDefined(tbMain)) {
for (i = 0; i < tbMain.items.length; i++) {
btn = tbMain.items.items[i];
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
if (btn.pressed) {
if (exclude) {
if (typeof exclude == "object") {
if (exclude.id == btn.id) {
continue;
}
} else {
if (btn.iconCls && !(btn.iconCls.search(exclude) < 0)) {
continue;
}
}
}
btn.toggle(false);
}
}
}
}
},
disableMenu: function (btns, disabled) {
var btn, i;
var tbMain = this.mainToolbar;
if (Ext.isDefined(tbMain)) {
var apply_all = false;
typeof btns == "string" && (btns == "all" ? apply_all = true : btns = [btns]);
for (i = 0; i < tbMain.items.length; i++) {
btn = tbMain.items.items[i];
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
if (apply_all || !(btns.indexOf(btn.id) < 0)) {
btn.pressed && btn.toggle(false);
btn.setDisabled(disabled);
}
}
}
}
},
onCoAuthoringChatReceiveMessage: function (messages) {
var mainMenu = Ext.getCmp("view-main-menu");
if (mainMenu) {
var activeStep;
mainMenu.getLayout().getActiveItem() && (activeStep = mainMenu.getLayout().getActiveItem().down("container"));
var btnChat = Ext.getCmp("id-menu-chat");
if (btnChat) {
if (!activeStep || !activeStep.isXType("commonchatpanel") || activeStep.getWidth() < 1) {
btnChat.addCls("notify");
}
}
}
},
onCoAuthoringDisconnect: function () {
this.disableMenu(["id-menu-comments", "id-menu-chat"], true);
},
onGetLicense: function (license) {
var panel = Ext.getCmp("main-menu-about");
if (panel) {
panel.setLicInfo(license);
}
},
createDelayedElements: function () {
var me = this;
this.hkEsc = new Ext.util.KeyMap(document, [{
key: Ext.EventObject.ESC,
fn: function (key, e) {
if (Ext.isDefined(me.currentFullScaleMenuBtn)) {
e.stopPropagation();
e.preventDefault();
me.currentFullScaleMenuBtn.toggle(false);
}
}
}]);
var addedItems = [],
addedButtons = this.mainToolbar.items.items,
item;
for (var i = 0; i < this.buttonCollection.length; i++) {
item = this.buttonCollection[i];
if (item.scale == "modal") {} else {
if (item.scale != "full") {
var cardPanel = Ext.create("Ext.container.Container", {
items: item.items,
menubutton: addedButtons[i],
listeners: {
afterrender: function (cmp) {
cmp.getEl().on("keydown", me._onMenuKeyDown, me, {
button: cmp.menubutton
});
}
}
});
addedButtons[i].bodyCardId = cardPanel.getId();
addedItems.push(cardPanel);
} else {
if (this.fullScaledItemCnt === undefined) {
this.fullScaledItemCnt = Ext.create("Ext.container.Container", {
id: MAINMENU_FULL_PANEL_ID,
layout: "card",
shadow: false,
floating: true,
toFrontOnShow: true,
closeMenu: function () {
me.closeFullScaleMenu();
},
getApi: function () {
return me.api;
}
});
}
addedButtons[i].bodyCardId = item.items[0].id;
this.fullScaledItemCnt.add(item.items);
}
}
}
me.api.asc_getLicense();
this.add(addedItems);
},
_onMenuKeyDown: function (event, target, opt) {
if (event.getKey() == event.ESC) {
if (opt.button) {
opt.button.toggle(false);
} else {
this.clearSelection();
}
}
}
});

View File

@@ -1,353 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.MainSettingsGeneral", {
extend: "Ext.container.Container",
alias: "widget.ssemainsettingsgeneral",
cls: "sse-documentsettings-body",
requires: ["Ext.button.Button", "Ext.container.Container", "Ext.form.Label", "Ext.form.field.Checkbox", "Ext.util.Cookies"],
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
this._changedProps = {
zoomIdx: 5,
showchangesIdx: 1,
fontrenderIdx: 0,
unitIdx: 0,
saveVal: 600
};
this._oldUnit = undefined;
this.chLiveComment = Ext.create("Ext.form.field.Checkbox", {
id: "docsettings-live-comment",
checked: true,
boxLabel: this.strLiveComment,
width: 500
});
this._arrZoom = [[50, "50%"], [60, "60%"], [70, "70%"], [80, "80%"], [90, "90%"], [100, "100%"], [110, "110%"], [120, "120%"], [150, "150%"], [175, "175%"], [200, "200%"]];
this.cmbZoom = Ext.create("Ext.form.field.ComboBox", {
width: 90,
editable: false,
store: this._arrZoom,
mode: "local",
triggerAction: "all",
value: this._arrZoom[5][1],
listeners: {
select: Ext.bind(function (combo, records, eOpts) {
this._changedProps.zoomIdx = records[0].index;
combo.blur();
},
this)
}
});
this._arrFontRender = [[c_oAscFontRenderingModeType.hintingAndSubpixeling, this.txtWin], [c_oAscFontRenderingModeType.noHinting, this.txtMac], [c_oAscFontRenderingModeType.hinting, this.txtNative]];
this.cmbFontRender = Ext.create("Ext.form.field.ComboBox", {
id: "docsettings-font-render",
width: 150,
editable: false,
store: this._arrFontRender,
mode: "local",
triggerAction: "all",
value: this._arrFontRender[0][1],
listeners: {
select: Ext.bind(function (combo, records, eOpts) {
this._changedProps.fontrenderIdx = records[0].index;
combo.blur();
},
this)
}
});
this._arrUnit = [[Common.MetricSettings.c_MetricUnits.cm, this.txtCm], [Common.MetricSettings.c_MetricUnits.pt, this.txtPt]];
this.cmbUnit = Ext.create("Ext.form.field.ComboBox", {
id: "docsettings-combo-unit",
width: 150,
editable: false,
store: this._arrUnit,
mode: "local",
triggerAction: "all",
value: this._arrUnit[0][1],
listeners: {
select: Ext.bind(function (combo, records, eOpts) {
this._changedProps.unitIdx = records[0].index;
combo.blur();
},
this)
}
});
this._arrAutoSave = [[0, this.textDisabled], [60, this.textMinute], [300, this.text5Minutes], [600, this.text10Minutes], [1800, this.text30Minutes], [3600, this.text60Minutes]];
this.cmbAutoSave = Ext.create("Ext.form.field.ComboBox", {
id: "docsettings-combo-save",
width: 150,
editable: false,
store: this._arrAutoSave,
mode: "local",
triggerAction: "all",
value: this._arrAutoSave[3][1],
listeners: {
select: Ext.bind(function (combo, records, eOpts) {
this._changedProps.saveVal = records[0].data.field1;
combo.blur();
},
this)
}
});
this.btnOk = Ext.widget("button", {
cls: "asc-blue-button",
width: 90,
height: 22,
text: this.okButtonText,
listeners: {
click: function (btn) {
this.applySettings();
},
scope: this
}
});
this.items = [{
xtype: "container",
layout: {
type: "table",
columns: 2,
tableAttrs: {
style: "width: 100%;"
},
tdAttrs: {
style: "padding: 5px 10px;"
}
},
height: "100%",
items: [{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.txtLiveComment,
style: "display: block;text-align: right; margin-bottom: 1px;",
width: "100%",
hideId: "element-coauthoring"
},
this.chLiveComment, {
xtype: "tbspacer",
hideId: "element-coauthoring"
},
{
xtype: "tbspacer"
},
{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.strZoom,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%"
},
this.cmbZoom, {
xtype: "tbspacer"
},
{
xtype: "tbspacer"
},
{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.strFontRender,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%"
},
this.cmbFontRender, {
xtype: "tbspacer",
hideId: "element-edit-mode"
},
{
xtype: "tbspacer"
},
{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.textAutoSave,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%",
hideId: "element-autosave"
},
this.cmbAutoSave, {
xtype: "tbspacer",
hideId: "element-autosave"
},
{
xtype: "tbspacer"
},
{
xtype: "label",
cellCls: "doc-info-label-cell",
text: this.strUnit,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%",
hideId: "element-edit-mode"
},
this.cmbUnit, {
xtype: "tbspacer",
height: 10
},
{
xtype: "tbspacer",
height: 10
},
{
xtype: "tbspacer"
},
this.btnOk]
}];
this.addEvents("savedocsettings");
this.addEvents("changemeasureunit");
this.callParent(arguments);
},
setApi: function (o) {
this.api = o;
},
applySettings: function () {
window.localStorage.setItem("sse-settings-livecomment", this.chLiveComment.getValue() ? 1 : 0);
window.localStorage.setItem("sse-settings-zoom", this._arrZoom[this._changedProps.zoomIdx][0]);
window.localStorage.setItem("sse-settings-fontrender", this._arrFontRender[this._changedProps.fontrenderIdx][0]);
window.localStorage.setItem("sse-settings-unit", this._arrUnit[this._changedProps.unitIdx][0]);
window.localStorage.setItem("sse-settings-autosave", this._changedProps.saveVal);
Common.component.Analytics.trackEvent("File Menu", "SaveSettings");
this.fireEvent("savedocsettings", this);
if (this._oldUnit !== this._arrUnit[this._changedProps.unitIdx][0]) {
this.fireEvent("changemeasureunit", this);
}
},
updateSettings: function () {
value = window.localStorage.getItem("sse-settings-livecomment");
this.chLiveComment.setValue(!(value !== null && parseInt(value) == 0));
var value = window.localStorage.getItem("sse-settings-zoom");
this._changedProps.zoomIdx = 5;
if (value !== null) {
for (var i = 0; i < this._arrZoom.length; i++) {
if (this._arrZoom[i][0] == parseInt(value)) {
this._changedProps.zoomIdx = i;
break;
}
}
}
this.cmbZoom.setValue(this._arrZoom[this._changedProps.zoomIdx][1]);
value = window.localStorage.getItem("sse-settings-fontrender");
if (value !== null) {
value = parseInt(value);
} else {
value = window.devicePixelRatio > 1 ? c_oAscFontRenderingModeType.noHinting : c_oAscFontRenderingModeType.hintingAndSubpixeling;
}
for (i = 0; i < this._arrFontRender.length; i++) {
if (this._arrFontRender[i][0] == value) {
this._changedProps.fontrenderIdx = i;
break;
}
}
this.cmbFontRender.setValue(this._arrFontRender[this._changedProps.fontrenderIdx][1]);
value = window.localStorage.getItem("sse-settings-unit");
this._changedProps.unitIdx = 0;
if (value !== null) {
for (i = 0; i < this._arrUnit.length; i++) {
if (this._arrUnit[i][0] == parseInt(value)) {
this._changedProps.unitIdx = i;
break;
}
}
}
this.cmbUnit.setValue(this._arrUnit[this._changedProps.unitIdx][1]);
this._oldUnit = this._arrUnit[this._changedProps.unitIdx][0];
value = window.localStorage.getItem("sse-settings-autosave");
value = (value !== null) ? parseInt(value) : 600;
this._changedProps.saveVal = 600;
var idx = 3;
for (i = 0; i < this._arrAutoSave.length; i++) {
if (this._arrAutoSave[i][0] == value) {
this._changedProps.saveVal = value;
idx = i;
break;
}
}
this.cmbAutoSave.setValue(this._arrAutoSave[idx][1]);
this._ShowHideDocSettings("element-autosave", this.mode.isEdit && (this.mode.canAutosave > -1));
},
_ShowHideSettingsItem: function (cmp, visible) {
var tr = cmp.getEl().up("tr");
if (tr) {
tr.setDisplayed(visible);
}
},
_ShowHideDocSettings: function (id, visible) {
if (!this.rendered) {
return;
}
var components = Ext.ComponentQuery.query('[hideId="' + id + '"]', this);
for (var i = 0; i < components.length; i++) {
this._ShowHideSettingsItem(components[i], visible);
}
},
setMode: function (mode) {
this.mode = mode;
if (this.mode.canAutosave > -1) {
var idx = 0;
for (idx = 1; idx < this._arrAutoSave.length; idx++) {
if (this.mode.canAutosave < this._arrAutoSave[idx][0]) {
break;
}
}
}
var arr = [];
arr = this._arrAutoSave.slice(idx, this._arrAutoSave.length);
arr.unshift(this._arrAutoSave[0]);
if (arr.length > 0) {
this.cmbAutoSave.getStore().loadData(arr);
}
},
strLiveComment: "Turn on live commenting option",
txtLiveComment: "Live Commenting",
strInputMode: "Turn on hieroglyphs",
strZoom: "Default Zoom Value",
strShowChanges: "Realtime Collaboration Changes",
txtAll: "View All",
txtLast: "View Last",
okButtonText: "Apply",
txtWin: "as Windows",
txtMac: "as OS X",
txtNative: "Native",
strFontRender: "Font Hinting",
strUnit: "Unit of Measurement",
txtCm: "Centimeter",
txtPt: "Point",
textDisabled: "Disabled",
textMinute: "Every Minute",
text5Minutes: "Every 5 Minutes",
text10Minutes: "Every 10 Minutes",
text30Minutes: "Every 30 Minutes",
text60Minutes: "Every Hour",
textAutoSave: "Autosave"
});

View File

@@ -1,366 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.MainSettingsPrint", {
extend: "Ext.container.Container",
alias: "widget.ssemainsettingsprint",
cls: "sse-documentsettings-body",
requires: ["Ext.button.Button", "Ext.container.Container", "Ext.form.Label", "Common.component.IndeterminateCheckBox"],
listeners: {
show: function (cmp, eOpts) {}
},
height: "100%",
initComponent: function () {
var me = this;
this.cmbSheet = Ext.create("Ext.form.field.ComboBox", {
id: "advsettings-print-combo-sheets",
width: 260,
editable: false,
store: Ext.create("Ext.data.Store", {
fields: ["sheetname", {
type: "int",
name: "sheetindex"
}],
data: [{
sheetname: me.strAllSheets,
sheetindex: -255
}]
}),
queryMode: "local",
displayField: "sheetname",
valueField: "sheetindex",
triggerAction: "all"
});
this.cmbPaperSize = Ext.widget("combo", {
width: 260,
store: Ext.create("Ext.data.Store", {
fields: ["description", "size"],
data: [{
size: "215.9|279.4",
description: "US Letter (21,59cm x 27,94cm)"
},
{
size: "215.9|355.6",
description: "US Legal (21,59cm x 35,56cm)"
},
{
size: "210|297",
description: "A4 (21cm x 29,7cm)"
},
{
size: "148.1|209.9",
description: "A5 (14,81cm x 20,99cm)"
},
{
size: "176|250.1",
description: "B5 (17,6cm x 25,01cm)"
},
{
size: "104.8|241.3",
description: "Envelope #10 (10,48cm x 24,13cm)"
},
{
size: "110.1|220.1",
description: "Envelope DL (11,01cm x 22,01cm)"
},
{
size: "279.4|431.7",
description: "Tabloid (27,94cm x 43,17cm)"
},
{
size: "297|420.1",
description: "A3 (29,7cm x 42,01cm)"
},
{
size: "304.8|457.1",
description: "Tabloid Oversize (30,48cm x 45,71cm)"
},
{
size: "196.8|273",
description: "ROC 16K (19,68cm x 27,3cm)"
},
{
size: "119.9|234.9",
description: "Envelope Choukei 3 (11,99cm x 23,49cm)"
},
{
size: "330.2|482.5",
description: "Super B/A3 (33,02cm x 48,25cm)"
}]
}),
displayField: "description",
valueField: "size",
queryMode: "local",
editable: false
});
this.cmbPaperOrientation = Ext.widget("combo", {
store: Ext.create("Ext.data.Store", {
fields: ["description", "orient"],
data: [{
description: me.strPortrait,
orient: c_oAscPageOrientation.PagePortrait
},
{
description: me.strLandscape,
orient: c_oAscPageOrientation.PageLandscape
}]
}),
displayField: "description",
valueField: "orient",
queryMode: "local",
editable: false,
width: 200
});
this.chPrintGrid = Ext.widget("cmdindeterminatecheckbox", {
boxLabel: this.textPrintGrid,
width: 500
});
this.chPrintRows = Ext.widget("cmdindeterminatecheckbox", {
boxLabel: this.textPrintHeadings,
width: 500
});
this.spnMarginLeft = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0.19 cm",
listeners: {}
});
this.spnMarginRight = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0.19 cm",
listeners: {}
});
this.spnMarginTop = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0 cm",
listeners: {}
});
this.spnMarginBottom = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0 cm",
listeners: {}
});
this.btnOk = Ext.widget("button", {
id: "advsettings-print-button-save",
cls: "asc-blue-button",
width: 90,
height: 22,
text: this.okButtonText
});
this.items = [{
xtype: "container",
layout: {
type: "table",
columns: 2,
tableAttrs: {
style: "width: 100%;"
},
tdAttrs: {
style: "padding: 10px 10px;"
}
},
items: [{
xtype: "label",
cellCls: "doc-info-label-cell",
text: me.textSettings,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%"
},
this.cmbSheet, {
xtype: "tbspacer",
height: 5
},
{
xtype: "tbspacer",
height: 5
},
{
xtype: "label",
cellCls: "doc-info-label-cell",
text: me.textPageSize,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%"
},
this.cmbPaperSize, {
xtype: "label",
cellCls: "doc-info-label-cell",
text: me.textPageOrientation,
style: "display: block;text-align: right; margin-bottom: 5px;",
width: "100%"
},
this.cmbPaperOrientation, {
xtype: "label",
cellCls: "doc-info-label-cell label-align-top",
text: me.strMargins,
style: "display: block;text-align: right;",
width: "100%"
},
this.cntMargins = Ext.widget("container", {
height: 100,
width: 200,
layout: {
type: "hbox"
},
defaults: {
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
height: 100
},
items: [{
flex: 1,
items: [{
xtype: "label",
width: "100%",
text: me.strTop
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginTop, {
xtype: "tbspacer",
height: 12
},
{
xtype: "label",
width: "100%",
text: me.strLeft
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginLeft]
},
{
xtype: "tbspacer",
width: 20
},
{
flex: 1,
items: [{
xtype: "label",
text: me.strBottom,
width: "100%"
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginBottom, {
xtype: "tbspacer",
height: 12
},
{
xtype: "label",
text: me.strRight,
width: "100%"
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginRight]
}]
}), {
xtype: "label",
cellCls: "doc-info-label-cell label-align-top",
text: me.strPrint,
style: "display: block;text-align: right; margin-top: 4px;",
width: "100%"
},
this.cntAdditional = Ext.widget("container", {
height: 45,
width: 500,
layout: {
type: "vbox",
align: "stretch"
},
items: [this.chPrintGrid, this.chPrintRows]
}), {
xtype: "tbspacer"
},
{
xtype: "tbspacer"
},
{
xtype: "tbspacer"
},
this.btnOk]
}];
this.addEvents("savedocsettings");
this.callParent(arguments);
},
applySettings: function () {},
setMode: function (mode) {},
updateMetricUnit: function () {
var spinners = this.query("commonmetricspinner");
if (spinners) {
for (var i = 0; i < spinners.length; i++) {
var spinner = spinners[i];
spinner.setDefaultUnit(Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
spinner.setStep(Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
okButtonText: "Save",
strPortrait: "Portrait",
strLandscape: "Landscape",
textPrintGrid: "Print Gridlines",
textPrintHeadings: "Print Rows and Columns Headings",
strLeft: "Left",
strRight: "Right",
strTop: "Top",
strBottom: "Bottom",
strMargins: "Margins",
textPageSize: "Page Size",
textPageOrientation: "Page Orientation",
strPrint: "Print",
textSettings: "Settings for"
});

View File

@@ -1,274 +1,149 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.OpenDialog", {
extend: "Ext.window.Window",
alias: "widget.sseopendialog",
requires: ["Ext.window.Window", "Common.plugin.ComboBoxScrollPane"],
modal: true,
closable: false,
resizable: false,
height: 218,
width: 250,
padding: "15px 0 0 0",
layout: {
type: "vbox",
align: "stretch"
},
cls: "csv-open-dialog",
initComponent: function () {
this.title = this.title || this.txtTitle;
var encodedata = [];
if (this.codepages) {
encodedata = [];
for (var i = 0; i < this.codepages.length; i++) {
var codepage = this.codepages[i];
var c = [];
c[0] = codepage.asc_getCodePage();
c[1] = codepage.asc_getCodePageName();
encodedata.push(c);
}
} else {
encodedata = [[37, "IBM EBCDIC (US-Canada)"], [437, "OEM United States"], [500, "IBM EBCDIC (International)"], [708, "Arabic (ASMO 708)"], [720, "Arabic (DOS)"], [737, "Greek (DOS)"], [775, "Baltic (DOS)"], [850, "Western European (DOS)"], [852, "Central European (DOS)"], [855, "OEM Cyrillic"], [857, "Turkish (DOS)"], [858, "OEM Multilingual Latin I"], [860, "Portuguese (DOS)"], [861, "Icelandic (DOS)"], [862, "Hebrew (DOS)"], [863, "French Canadian (DOS)"], [864, "Arabic (864) "], [865, "Nordic (DOS)"], [866, "Cyrillic (DOS)"], [869, "Greek, Modern (DOS)"], [870, "IBM EBCDIC (Multilingual Latin-2)"], [874, "Thai (Windows)"], [875, "IBM EBCDIC (Greek Modern)"], [932, "Japanese (Shift-JIS)"], [936, "Chinese Simplified (GB2312)"], [949, "Korean"], [950, "Chinese Traditional (Big5)"], [1026, "IBM EBCDIC (Turkish Latin-5)"], [1047, "IBM Latin-1"], [1140, "IBM EBCDIC (US-Canada-Euro)"], [1141, "IBM EBCDIC (Germany-Euro)"], [1142, "IBM EBCDIC (Denmark-Norway-Euro)"], [1143, "IBM EBCDIC (Finland-Sweden-Euro)"], [1144, "IBM EBCDIC (Italy-Euro)"], [1145, "IBM EBCDIC (Spain-Euro)"], [1146, "IBM EBCDIC (UK-Euro)"], [1147, "IBM EBCDIC (France-Euro)"], [1148, "IBM EBCDIC (International-Euro)"], [1149, "IBM EBCDIC (Icelandic-Euro)"], [1200, "Unicode"], [1201, "Unicode (Big-Endian)"], [1250, "Central European (Windows)"], [1251, "Cyrillic (Windows)"], [1252, "Western European (Windows)"], [1253, "Greek (Windows)"], [1254, "Turkish (Windows)"], [1255, "Hebrew (Windows) "], [1256, "Arabic (Windows) "], [1257, "Baltic (Windows)"], [1258, "Vietnamese (Windows)"], [1361, "Korean (Johab)"], [10000, "Western European (Mac)"], [10001, "Japanese (Mac)"], [10002, "Chinese Traditional (Mac)"], [10003, "Korean (Mac)"], [10004, "Arabic (Mac) "], [10005, "Hebrew (Mac)"], [10006, "Greek (Mac) "], [10007, "Cyrillic (Mac)"], [10008, "Chinese Simplified (Mac)"], [10010, "Romanian (Mac)"], [10017, "Ukrainian (Mac)"], [10021, "Thai (Mac)"], [10029, "Central European (Mac) "], [10079, "Icelandic (Mac)"], [10081, "Turkish (Mac)"], [10082, "Croatian (Mac)"], [12000, "Unicode (UTF-32)"], [12001, "Unicode (UTF-32 Big-Endian)"], [20000, "Chinese Traditional (CNS)"], [20001, "TCA Taiwan"], [20002, "Chinese Traditional (Eten)"], [20003, "IBM5550 Taiwan"], [20004, "TeleText Taiwan"], [20005, "Wang Taiwan"], [20105, "Western European (IA5)"], [20106, "German (IA5)"], [20107, "Swedish (IA5) "], [20108, "Norwegian (IA5) "], [20127, "US-ASCII"], [20261, "T.61 "], [20269, "ISO-6937"], [20273, "IBM EBCDIC (Germany)"], [20277, "IBM EBCDIC (Denmark-Norway) "], [20278, "IBM EBCDIC (Finland-Sweden)"], [20280, "IBM EBCDIC (Italy)"], [20284, "IBM EBCDIC (Spain)"], [20285, "IBM EBCDIC (UK)"], [20290, "IBM EBCDIC (Japanese katakana)"], [20297, "IBM EBCDIC (France)"], [20420, "IBM EBCDIC (Arabic)"], [20423, "IBM EBCDIC (Greek)"], [20424, "IBM EBCDIC (Hebrew)"], [20833, "IBM EBCDIC (Korean Extended)"], [20838, "IBM EBCDIC (Thai)"], [20866, "Cyrillic (KOI8-R)"], [20871, "IBM EBCDIC (Icelandic) "], [20880, "IBM EBCDIC (Cyrillic Russian)"], [20905, "IBM EBCDIC (Turkish)"], [20924, "IBM Latin-1 "], [20932, "Japanese (JIS 0208-1990 and 0212-1990)"], [20936, "Chinese Simplified (GB2312-80) "], [20949, "Korean Wansung "], [21025, "IBM EBCDIC (Cyrillic Serbian-Bulgarian)"], [21866, "Cyrillic (KOI8-U)"], [28591, "Western European (ISO) "], [28592, "Central European (ISO)"], [28593, "Latin 3 (ISO)"], [28594, "Baltic (ISO)"], [28595, "Cyrillic (ISO) "], [28596, "Arabic (ISO)"], [28597, "Greek (ISO) "], [28598, "Hebrew (ISO-Visual)"], [28599, "Turkish (ISO)"], [28603, "Estonian (ISO)"], [28605, "Latin 9 (ISO)"], [29001, "Europa"], [38598, "Hebrew (ISO-Logical)"], [50220, "Japanese (JIS)"], [50221, "Japanese (JIS-Allow 1 byte Kana) "], [50222, "Japanese (JIS-Allow 1 byte Kana - SO/SI)"], [50225, "Korean (ISO)"], [50227, "Chinese Simplified (ISO-2022)"], [51932, "Japanese (EUC)"], [51936, "Chinese Simplified (EUC) "], [51949, "Korean (EUC)"], [52936, "Chinese Simplified (HZ)"], [54936, "Chinese Simplified (GB18030)"], [57002, "ISCII Devanagari "], [57003, "ISCII Bengali "], [57004, "ISCII Tamil"], [57005, "ISCII Telugu "], [57006, "ISCII Assamese "], [57007, "ISCII Oriya"], [57008, "ISCII Kannada"], [57009, "ISCII Malayalam "], [57010, "ISCII Gujarati"], [57011, "ISCII Punjabi"], [65000, "Unicode (UTF-7)"], [65001, "Unicode (UTF-8)"]];
}
var encodestore = Ext.create("Ext.data.ArrayStore", {
autoDestroy: true,
storeId: "encodeStore",
idIndex: 0,
fields: [{
name: "value",
type: "int"
},
{
name: "name",
type: "string"
}],
data: encodedata
});
this.cmbEncoding = Ext.create("Ext.form.field.ComboBox", {
store: encodestore,
displayField: "name",
queryMode: "local",
typeAhead: false,
editable: false,
listeners: {
keydown: this._handleKeyDown,
select: function (combo, records, eOpts) {
this.encoding = records[0].data.value;
},
scope: this
},
enableKeyEvents: true,
plugins: [{
pluginId: "scrollpane",
ptype: "comboboxscrollpane",
settings: {
enableKeyboardNavigation: true
}
}]
});
this.cmbEncoding.select(encodestore.getAt(0));
this.encoding = encodestore.getAt(0).data.value;
var delimiterstore = Ext.create("Ext.data.ArrayStore", {
autoDestroy: true,
storeId: "delimiterStore",
idIndex: 0,
fields: [{
name: "value",
type: "int"
},
{
name: "description",
type: "string"
}],
data: [[4, ","], [2, ";"], [3, ":"], [1, this.txtTab], [5, this.txtSpace]]
});
this.cmbDelimiter = Ext.create("Ext.form.field.ComboBox", {
width: 70,
store: delimiterstore,
displayField: "description",
queryMode: "local",
typeAhead: false,
editable: false,
listeners: {
select: function (combo, records, eOpts) {
this.delimiter = records[0].data.value;
},
scope: this
}
});
this.cmbDelimiter.select(delimiterstore.getAt(0));
this.delimiter = delimiterstore.getAt(0).data.value;
this.items = [{
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
padding: "0 20px 0 20px",
height: 46,
width: 210,
items: [{
xtype: "label",
text: this.txtEncoding,
style: "font-weight: bold;margin:0 0 4px 0;"
},
this.cmbEncoding]
},
{
xtype: "tbspacer",
height: 10
},
{
xtype: "container",
layout: {
type: "vbox",
align: "left"
},
padding: "0 20px 0 20px",
height: 46,
width: 210,
items: [{
xtype: "label",
text: this.txtDelimiter,
style: "font-weight: bold;margin:0 0 4px 0;"
},
this.cmbDelimiter]
},
{
xtype: "tbspacer",
height: 10
},
{
xtype: "tbspacer",
height: 8,
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
},
{
xtype: "container",
height: 40,
layout: {
type: "vbox",
align: "center",
pack: "center"
},
items: [{
xtype: "container",
width: 86,
height: 24,
layout: {
type: "hbox",
align: "middle"
},
items: [this.btnOk = Ext.widget("button", {
cls: "asc-blue-button",
width: 86,
height: 22,
margin: "0 5px 0 0",
text: this.okButtonText,
listeners: {
click: function (btn) {
this.fireEvent("onmodalresult", this, 1, {
encoding: this.encoding,
delimiter: this.delimiter
});
this.close();
},
scope: this
}
})]
}]
}];
this.callParent(arguments);
},
setSettings: function (s) {
var index = this.cmbEncoding.getStore().find("value", s.asc_getCodePage ? s.asc_getCodePage() : s.encoding);
if (! (index < 0)) {
this.cmbEncoding.select(this.cmbEncoding.getStore().getAt(index));
this.encoding = s.asc_getCodePage();
}
index = this.cmbDelimiter.getStore().find("value", s.asc_getDelimiter ? s.asc_getDelimiter() : s.delimiter);
if (! (index < 0)) {
this.cmbDelimiter.select(this.cmbDelimiter.getStore().getAt(index));
this.delimiter = s.asc_getDelimiter();
}
},
scrollViewToNode: function (dataview, node) {
if (dataview && node) {
var plugin = dataview.getPlugin("scrollpane");
if (plugin) {
var doScroll = new Ext.util.DelayedTask(function () {
plugin.scrollToElement(node, false, true);
});
doScroll.delay(100);
}
}
},
_handleKeyDown: function (combo, event) {
if (event.ctrlKey || event.altKey) {
return;
}
var charcode = String.fromCharCode(event.getCharCode());
if (/[A-Z0-9]/.test(charcode)) {
if ((new Date().getTime()) - combo.lastsearchtime > 3000) {
combo.lastsearchquery = "";
}
var str = combo.lastsearchquery + charcode;
var index = combo.getStore().find("name", str, combo.lastsearchindex);
if (index < 0) {
str = charcode;
index = combo.getStore().find("name", str, combo.lastsearchindex);
if (index < 0) {
index = combo.getStore().find("name", str, 0);
}
}
combo.lastsearchtime = new Date().getTime();
if (! (index < 0)) {
var item = combo.getStore().getAt(index);
var node = combo.getPicker().getNode(item);
combo.select(item);
this.scrollViewToNode(combo, node);
combo.lastsearchquery = str;
combo.lastsearchindex = ++index < combo.getStore().getCount() ? index : 0;
} else {
combo.lastsearchquery = "";
combo.lastsearchindex = 0;
}
}
},
cancelButtonText: "Cancel",
okButtonText: "Ok",
txtEncoding: "Encoding ",
txtDelimiter: "Delimiter",
txtTab: "Tab",
txtSpace: "Space",
txtTitle: "Choose CSV options"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["common/main/lib/component/Window"], function () {
SSE.Views = SSE.Views || {};
SSE.Views.OpenDialog = Common.UI.Window.extend(_.extend({
applyFunction: undefined,
initialize: function (options) {
var t = this,
_options = {};
_.extend(_options, {
width: 250,
height: 220,
contentWidth: 390,
header: true,
cls: "open-dlg",
contentTemplate: "",
title: t.txtTitle
},
options);
this.template = options.template || ['<div class="box" style="height:' + (_options.height - 85) + 'px;">', '<div class="content-panel" >', '<label class="header">' + t.txtEncoding + "</label>", '<div id="id-codepages-combo" class="input-group-nr" style="margin-top:10px;margin-bottom:10px;"></div>', '<label class="header">' + t.txtDelimiter + "</label>", '<div id="id-delimiters-combo" class="input-group-nr" style="margin-top:10px;max-width: 110px;"></div>', "</div>", "</div>", '<div class="separator horizontal"/>', '<div class="footer center">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">' + t.okButtonText + "</button>", "</div>"].join("");
this.handler = options.handler;
this.codepages = options.codepages;
this.settings = options.settings;
_options.tpl = _.template(this.template, _options);
Common.UI.Window.prototype.initialize.call(this, _options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
if (this.$window) {
this.$window.find(".tool").hide();
this.$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
this.initCodePages();
}
},
onBtnClick: function (event) {
if (this.handler && this.cmbEncoding && this.cmbDelimiter) {
this.handler.call(this, this.cmbEncoding.getValue(), this.cmbDelimiter.getValue());
}
this.close();
},
initCodePages: function () {
var i, c, codepage, encodedata = [],
listItems = [],
length = 0;
if (this.codepages) {
encodedata = [];
for (i = 0; i < this.codepages.length; ++i) {
codepage = this.codepages[i];
c = [];
c[0] = codepage.asc_getCodePage();
c[1] = codepage.asc_getCodePageName();
encodedata.push(c);
}
} else {
encodedata = [[37, "IBM EBCDIC (US-Canada)"], [437, "OEM United States"], [500, "IBM EBCDIC (International)"], [708, "Arabic (ASMO 708)"], [720, "Arabic (DOS)"], [737, "Greek (DOS)"], [775, "Baltic (DOS)"], [850, "Western European (DOS)"], [852, "Central European (DOS)"], [855, "OEM Cyrillic"], [857, "Turkish (DOS)"], [858, "OEM Multilingual Latin I"], [860, "Portuguese (DOS)"], [861, "Icelandic (DOS)"], [862, "Hebrew (DOS)"], [863, "French Canadian (DOS)"], [864, "Arabic (864) "], [865, "Nordic (DOS)"], [866, "Cyrillic (DOS)"], [869, "Greek, Modern (DOS)"], [870, "IBM EBCDIC (Multilingual Latin-2)"], [874, "Thai (Windows)"], [875, "IBM EBCDIC (Greek Modern)"], [932, "Japanese (Shift-JIS)"], [936, "Chinese Simplified (GB2312)"], [949, "Korean"], [950, "Chinese Traditional (Big5)"], [1026, "IBM EBCDIC (Turkish Latin-5)"], [1047, "IBM Latin-1"], [1140, "IBM EBCDIC (US-Canada-Euro)"], [1141, "IBM EBCDIC (Germany-Euro)"], [1142, "IBM EBCDIC (Denmark-Norway-Euro)"], [1143, "IBM EBCDIC (Finland-Sweden-Euro)"], [1144, "IBM EBCDIC (Italy-Euro)"], [1145, "IBM EBCDIC (Spain-Euro)"], [1146, "IBM EBCDIC (UK-Euro)"], [1147, "IBM EBCDIC (France-Euro)"], [1148, "IBM EBCDIC (International-Euro)"], [1149, "IBM EBCDIC (Icelandic-Euro)"], [1200, "Unicode"], [1201, "Unicode (Big-Endian)"], [1250, "Central European (Windows)"], [1251, "Cyrillic (Windows)"], [1252, "Western European (Windows)"], [1253, "Greek (Windows)"], [1254, "Turkish (Windows)"], [1255, "Hebrew (Windows) "], [1256, "Arabic (Windows) "], [1257, "Baltic (Windows)"], [1258, "Vietnamese (Windows)"], [1361, "Korean (Johab)"], [10000, "Western European (Mac)"], [10001, "Japanese (Mac)"], [10002, "Chinese Traditional (Mac)"], [10003, "Korean (Mac)"], [10004, "Arabic (Mac) "], [10005, "Hebrew (Mac)"], [10006, "Greek (Mac) "], [10007, "Cyrillic (Mac)"], [10008, "Chinese Simplified (Mac)"], [10010, "Romanian (Mac)"], [10017, "Ukrainian (Mac)"], [10021, "Thai (Mac)"], [10029, "Central European (Mac) "], [10079, "Icelandic (Mac)"], [10081, "Turkish (Mac)"], [10082, "Croatian (Mac)"], [12000, "Unicode (UTF-32)"], [12001, "Unicode (UTF-32 Big-Endian)"], [20000, "Chinese Traditional (CNS)"], [20001, "TCA Taiwan"], [20002, "Chinese Traditional (Eten)"], [20003, "IBM5550 Taiwan"], [20004, "TeleText Taiwan"], [20005, "Wang Taiwan"], [20105, "Western European (IA5)"], [20106, "German (IA5)"], [20107, "Swedish (IA5) "], [20108, "Norwegian (IA5) "], [20127, "US-ASCII"], [20261, "T.61 "], [20269, "ISO-6937"], [20273, "IBM EBCDIC (Germany)"], [20277, "IBM EBCDIC (Denmark-Norway) "], [20278, "IBM EBCDIC (Finland-Sweden)"], [20280, "IBM EBCDIC (Italy)"], [20284, "IBM EBCDIC (Spain)"], [20285, "IBM EBCDIC (UK)"], [20290, "IBM EBCDIC (Japanese katakana)"], [20297, "IBM EBCDIC (France)"], [20420, "IBM EBCDIC (Arabic)"], [20423, "IBM EBCDIC (Greek)"], [20424, "IBM EBCDIC (Hebrew)"], [20833, "IBM EBCDIC (Korean Extended)"], [20838, "IBM EBCDIC (Thai)"], [20866, "Cyrillic (KOI8-R)"], [20871, "IBM EBCDIC (Icelandic) "], [20880, "IBM EBCDIC (Cyrillic Russian)"], [20905, "IBM EBCDIC (Turkish)"], [20924, "IBM Latin-1 "], [20932, "Japanese (JIS 0208-1990 and 0212-1990)"], [20936, "Chinese Simplified (GB2312-80) "], [20949, "Korean Wansung "], [21025, "IBM EBCDIC (Cyrillic Serbian-Bulgarian)"], [21866, "Cyrillic (KOI8-U)"], [28591, "Western European (ISO) "], [28592, "Central European (ISO)"], [28593, "Latin 3 (ISO)"], [28594, "Baltic (ISO)"], [28595, "Cyrillic (ISO) "], [28596, "Arabic (ISO)"], [28597, "Greek (ISO) "], [28598, "Hebrew (ISO-Visual)"], [28599, "Turkish (ISO)"], [28603, "Estonian (ISO)"], [28605, "Latin 9 (ISO)"], [29001, "Europa"], [38598, "Hebrew (ISO-Logical)"], [50220, "Japanese (JIS)"], [50221, "Japanese (JIS-Allow 1 byte Kana) "], [50222, "Japanese (JIS-Allow 1 byte Kana - SO/SI)"], [50225, "Korean (ISO)"], [50227, "Chinese Simplified (ISO-2022)"], [51932, "Japanese (EUC)"], [51936, "Chinese Simplified (EUC) "], [51949, "Korean (EUC)"], [52936, "Chinese Simplified (HZ)"], [54936, "Chinese Simplified (GB18030)"], [57002, "ISCII Devanagari "], [57003, "ISCII Bengali "], [57004, "ISCII Tamil"], [57005, "ISCII Telugu "], [57006, "ISCII Assamese "], [57007, "ISCII Oriya"], [57008, "ISCII Kannada"], [57009, "ISCII Malayalam "], [57010, "ISCII Gujarati"], [57011, "ISCII Punjabi"], [65000, "Unicode (UTF-7)"], [65001, "Unicode (UTF-8)"]];
}
length = encodedata.length;
if (length) {
for (i = 0; i < length; ++i) {
listItems.push({
value: encodedata[i][0],
displayValue: encodedata[i][1]
});
}
this.cmbEncoding = new Common.UI.ComboBox({
el: $("#id-codepages-combo", this.$window),
menuStyle: "min-width: 220px;",
cls: "input-group-nr",
menuCls: "scrollable-menu",
data: listItems,
editable: false
});
this.cmbDelimiter = new Common.UI.ComboBox({
el: $("#id-delimiters-combo", this.$window),
menuStyle: "min-width: 110px;",
cls: "input-group-nr",
data: [{
value: 4,
displayValue: ","
},
{
value: 2,
displayValue: ";"
},
{
value: 3,
displayValue: ":"
},
{
value: 1,
displayValue: this.txtTab
},
{
value: 5,
displayValue: this.txtSpace
}],
editable: false
});
this.cmbDelimiter.setValue(4);
if (encodedata.length) {
this.cmbEncoding.setValue(encodedata[0][0]);
if (this.settings && this.settings.asc_getCodePage()) {
this.cmbEncoding.setValue(this.settings.asc_getCodePage());
}
if (this.settings && this.settings.asc_getDelimiter()) {
this.cmbDelimiter.setValue(this.settings.asc_getDelimiter());
}
}
}
},
okButtonText: "OK",
cancelButtonText: "Cancel",
txtDelimiter: "Delimiter",
txtEncoding: "Encoding ",
txtSpace: "Space",
txtTab: "Tab",
txtTitle: "Choose CSV options"
},
SSE.Views.OpenDialog || {}));
});

View File

@@ -1,441 +1,334 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var c_paragraphLinerule = {
LINERULE_LEAST: 0,
LINERULE_AUTO: 1,
LINERULE_EXACT: 2
};
Ext.define("SSE.view.ParagraphSettings", {
extend: "Common.view.AbstractSettingsPanel",
alias: "widget.sseparagraphsettings",
height: 176,
requires: ["Ext.DomHelper", "Ext.button.Button", "Ext.form.Label", "Ext.container.Container", "Ext.toolbar.Spacer", "Common.component.MetricSpinner", "Ext.form.field.ComboBox", "SSE.view.ParagraphSettingsAdvanced"],
constructor: function (config) {
this.callParent(arguments);
this.initConfig(config);
return this;
},
setApi: function (o) {
this.api = o;
this.api.asc_registerCallback("asc_onParaSpacingLine", Ext.bind(this._onLineSpacing, this));
},
initComponent: function () {
this.title = this.txtTitle;
this._initSettings = true;
this._state = {
LineRuleIdx: 1,
LineHeight: 1.5,
LineSpacingBefore: 0,
LineSpacingAfter: 0.35
};
this._arrLineRule = [this.textAtLeast, this.textAuto, this.textExact];
this._arrLineDefaults = [[5, "cm", 0.03, 0.01], [1, "", 0.5, 0.01], [5, "cm", 0.03, 0.01]];
this.cmbLineRule = Ext.create("Ext.form.field.ComboBox", {
id: "table-combo-line-rule",
width: 85,
editable: false,
store: this._arrLineRule,
mode: "local",
triggerAction: "all",
listeners: {
select: Ext.bind(function (combo, records, eOpts) {
if (this.api) {
this.api.asc_putPrLineSpacing(records[0].index, this._arrLineDefaults[records[0].index][0]);
}
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[records[0].index][1]);
this.numLineHeight.setMinValue(this._arrLineDefaults[records[0].index][2]);
this.numLineHeight.setStep(this._arrLineDefaults[records[0].index][3]);
this.fireEvent("editcomplete", this);
},
this)
}
});
this.cmbLineRule.setValue(this._arrLineRule[1]);
this.controls.push(this.cmbLineRule);
this.numLineHeight = Ext.widget("commonmetricspinner", {
id: "paragraph-spin-line-height",
readOnly: false,
step: 0.01,
width: 85,
value: "1.5",
defaultUnit: "",
maxValue: 132,
minValue: 0,
listeners: {
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
if (this.cmbLineRule.getValue() == "") {
return;
}
var type = c_paragraphLinerule.LINERULE_AUTO;
for (var i = 0; i < this._arrLineRule.length; i++) {
if (this.cmbLineRule.getValue() == this._arrLineRule[i]) {
type = i;
break;
}
}
if (this.api) {
this.api.asc_putPrLineSpacing(type, (type == c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
}
this.fireEvent("editcomplete", this);
},
this)
}
});
this.controls.push(this.numLineHeight);
this.numSpacingBefore = Ext.create("Common.component.MetricSpinner", {
id: "paragraph-spin-spacing-before",
readOnly: false,
step: 0.1,
width: 85,
defaultUnit: "cm",
value: "0 cm",
maxValue: 55.88,
minValue: 0,
allowAuto: true,
autoText: this.txtAutoText,
listeners: {
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
if (this.api) {
var num = field.getNumberValue();
if (num < 0) {
this.api.asc_putLineSpacingBeforeAfter(0, -1);
} else {
this.api.asc_putLineSpacingBeforeAfter(0, Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
}
}
this.fireEvent("editcomplete", this);
},
this)
}
});
this.controls.push(this.numSpacingBefore);
this.numSpacingAfter = Ext.create("Common.component.MetricSpinner", {
id: "paragraph-spin-spacing-after",
readOnly: false,
step: 0.1,
width: 85,
defaultUnit: "cm",
value: "0.35 cm",
maxValue: 55.88,
minValue: 0,
allowAuto: true,
autoText: this.txtAutoText,
listeners: {
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
if (this.api) {
var num = field.getNumberValue();
if (num < 0) {
this.api.asc_putLineSpacingBeforeAfter(1, -1);
} else {
this.api.asc_putLineSpacingBeforeAfter(1, Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
}
}
this.fireEvent("editcomplete", this);
},
this)
}
});
this.controls.push(this.numSpacingAfter);
this._SpacingPanel = Ext.create("Ext.container.Container", {
layout: "vbox",
layoutConfig: {
align: "stretch"
},
height: 107,
width: 190,
items: [{
xtype: "tbspacer",
height: 8
},
{
xtype: "container",
height: 41,
layout: {
type: "table",
columns: 2,
tdAttrs: {
style: "padding-right: 8px;vertical-align: middle;"
}
},
items: [{
xtype: "label",
text: this.strLineHeight,
style: "display: block;",
width: 85
},
{
xtype: "label",
text: this.textAt,
style: "display: block;",
width: 85
},
{
xtype: "tbspacer",
height: 2
},
{
xtype: "tbspacer",
height: 2
},
this.cmbLineRule, this.numLineHeight]
},
{
xtype: "tbspacer",
height: 10
},
{
xtype: "container",
layout: {
type: "table",
columns: 2,
tdAttrs: {
style: "padding-right: 8px;"
}
},
defaults: {
xtype: "container",
layout: "vbox",
layoutConfig: {
align: "stretch"
},
height: 48,
style: "float:left;"
},
items: [{
items: [{
xtype: "label",
text: this.strSpacingBefore,
width: 85
},
{
xtype: "tbspacer",
height: 3
},
this.numSpacingBefore]
},
{
items: [{
xtype: "label",
text: this.strSpacingAfter,
width: 85
},
{
xtype: "tbspacer",
height: 3
},
this.numSpacingAfter]
}]
}]
});
this.items = [{
xtype: "tbspacer",
height: 9
},
{
xtype: "label",
style: "font-weight: bold;margin-top: 1px;",
text: this.strParagraphSpacing
},
this._SpacingPanel, {
xtype: "tbspacer",
height: 3
},
{
xtype: "tbspacer",
width: "100%",
height: 10,
style: "padding-right: 10px;",
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
},
{
xtype: "tbspacer",
height: 3
},
{
xtype: "container",
height: 20,
width: "100%",
items: [{
xtype: "box",
html: '<div style="width:100%;text-align:center;padding-right:15px;"><label id="paragraph-advanced-link" class="asc-advanced-link">' + this.textAdvanced + "</label></div>",
listeners: {
afterrender: function (cmp) {
document.getElementById("paragraph-advanced-link").onclick = Ext.bind(this._openAdvancedSettings, this);
},
scope: this
}
}]
}];
this.addEvents("editcomplete");
this.callParent(arguments);
},
_onLineSpacing: function (value) {
var linerule = value.asc_getLineRule();
var line = value.asc_getLine();
this.numLineHeight.suspendEvents(false);
this.cmbLineRule.suspendEvents(false);
if (this._state.LineRuleIdx !== linerule) {
this.cmbLineRule.setValue((linerule !== null) ? this._arrLineRule[linerule] : "");
this.numLineHeight.setMinValue(this._arrLineDefaults[(linerule !== null) ? linerule : 1][2]);
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[(linerule !== null) ? linerule : 1][1]);
this.numLineHeight.setStep(this._arrLineDefaults[(linerule !== null) ? linerule : 1][3]);
this._state.LineRuleIdx = linerule;
}
if (Math.abs(this._state.LineHeight - line) > 0.001 || (this._state.LineHeight === null || line === null) && (this._state.LineHeight !== line)) {
var val = "";
if (linerule == c_paragraphLinerule.LINERULE_AUTO) {
val = line;
} else {
if (linerule !== null && line !== null) {
val = Common.MetricSettings.fnRecalcFromMM(line);
}
}
this.numLineHeight.setValue((val !== null) ? val : "");
this._state.LineHeight = line;
}
this.numLineHeight.resumeEvents();
this.cmbLineRule.resumeEvents();
},
ChangeSettings: function (prop) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
if (prop) {
this.SuspendEvents();
var Spacing = {
Line: prop.asc_getSpacing().asc_getLine(),
Before: prop.asc_getSpacing().asc_getBefore(),
After: prop.asc_getSpacing().asc_getAfter(),
LineRule: prop.asc_getSpacing().asc_getLineRule()
};
if (this._state.LineRuleIdx !== Spacing.LineRule) {
this.cmbLineRule.setValue((Spacing.LineRule !== null) ? this._arrLineRule[Spacing.LineRule] : "");
this.numLineHeight.setMinValue(this._arrLineDefaults[(Spacing.LineRule !== null) ? Spacing.LineRule : 1][2]);
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[(Spacing.LineRule !== null) ? Spacing.LineRule : 1][1]);
this.numLineHeight.setStep(this._arrLineDefaults[(Spacing.LineRule !== null) ? Spacing.LineRule : 1][3]);
this._state.LineRuleIdx = Spacing.LineRule;
}
if (Math.abs(this._state.LineHeight - Spacing.Line) > 0.001 || (this._state.LineHeight === null || Spacing.Line === null) && (this._state.LineHeight !== Spacing.Line)) {
var val = "";
if (Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO) {
val = Spacing.Line;
} else {
if (Spacing.LineRule !== null && Spacing.Line !== null) {
val = Common.MetricSettings.fnRecalcFromMM(Spacing.Line);
}
}
this.numLineHeight.setValue((val !== null) ? val : "");
this._state.LineHeight = Spacing.Line;
}
if (Math.abs(this._state.LineSpacingBefore - Spacing.Before) > 0.001 || (this._state.LineSpacingBefore === null || Spacing.Before === null) && (this._state.LineSpacingBefore !== Spacing.Before)) {
this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before < 0) ? Spacing.Before : Common.MetricSettings.fnRecalcFromMM(Spacing.Before)) : "");
this._state.LineSpacingBefore = Spacing.Before;
}
if (Math.abs(this._state.LineSpacingAfter - Spacing.After) > 0.001 || (this._state.LineSpacingAfter === null || Spacing.After === null) && (this._state.LineSpacingAfter !== Spacing.After)) {
this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After < 0) ? Spacing.After : Common.MetricSettings.fnRecalcFromMM(Spacing.After)) : "");
this._state.LineSpacingAfter = Spacing.After;
}
this.ResumeEvents();
}
},
updateMetricUnit: function () {
var spinners = this.query("commonmetricspinner");
if (spinners) {
for (var i = 0; i < spinners.length; i++) {
var spinner = spinners[i];
if (spinner.id == "paragraph-spin-line-height") {
continue;
}
spinner.setDefaultUnit(Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
spinner.setStep(Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm ? 0.01 : 1);
}
}
this._arrLineDefaults[2][1] = this._arrLineDefaults[0][1] = Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()];
this._arrLineDefaults[2][2] = this._arrLineDefaults[0][2] = parseFloat(Common.MetricSettings.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineDefaults[2][3] = this._arrLineDefaults[0][3] = (Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm) ? 0.01 : 1;
if (this._state.LineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[this._state.LineRuleIdx][1]);
this.numLineHeight.setStep(this._arrLineDefaults[this._state.LineRuleIdx][3]);
}
},
_openAdvancedSettings: function (e) {
var me = this;
var win;
if (me.api) {
var selectedElements = me.api.asc_getGraphicObjectProps();
if (selectedElements && Ext.isArray(selectedElements)) {
var elType, elValue;
for (var i = selectedElements.length - 1; i >= 0; i--) {
elType = selectedElements[i].asc_getObjectType();
elValue = selectedElements[i].asc_getObjectValue();
if (c_oAscTypeSelectElement.Paragraph == elType) {
win = Ext.create("SSE.view.ParagraphSettingsAdvanced");
win.updateMetricUnit();
win.setSettings({
paragraphProps: elValue,
api: me.api
});
break;
}
}
}
}
if (win) {
win.addListener("onmodalresult", Ext.bind(function (o, mr, s) {
if (mr == 1 && s) {
me.api.asc_setGraphicObjectProps(s.paragraphProps);
}
},
this), false);
win.addListener("close", function () {
me.fireEvent("editcomplete", me);
},
false);
win.show();
}
},
createDelayedElements: function () {
this.updateMetricUnit();
},
strParagraphSpacing: "Spacing",
strLineHeight: "Line Spacing",
strSpacingBefore: "Before",
strSpacingAfter: "After",
textAuto: "Multiple",
textAtLeast: "At least",
textExact: "Exactly",
textAt: "At",
txtTitle: "Paragraph",
txtAutoText: "Auto",
textAdvanced: "Show advanced settings"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var c_paragraphLinerule = {
LINERULE_LEAST: 0,
LINERULE_AUTO: 1,
LINERULE_EXACT: 2
};
define(["text!spreadsheeteditor/main/app/template/ParagraphSettings.template", "jquery", "underscore", "backbone", "common/main/lib/component/ComboBox", "common/main/lib/component/MetricSpinner", "spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced"], function (menuTemplate, $, _, Backbone) {
SSE.Views.ParagraphSettings = Backbone.View.extend(_.extend({
el: "#id-paragraph-settings",
template: _.template(menuTemplate),
events: {},
options: {
alias: "ParagraphSettings"
},
initialize: function () {
var me = this;
this._initSettings = true;
this._state = {
LineRuleIdx: 1,
LineHeight: 1.5,
LineSpacingBefore: 0,
LineSpacingAfter: 0.35,
DisabledControls: false
};
this.spinners = [];
this.lockedControls = [];
this._locked = false;
this.render();
this._arrLineRule = [{
displayValue: this.textAtLeast,
defaultValue: 5,
value: c_paragraphLinerule.LINERULE_LEAST,
minValue: 0.03,
step: 0.01,
defaultUnit: "cm"
},
{
displayValue: this.textAuto,
defaultValue: 1,
value: c_paragraphLinerule.LINERULE_AUTO,
minValue: 0.5,
step: 0.01,
defaultUnit: ""
},
{
displayValue: this.textExact,
defaultValue: 5,
value: c_paragraphLinerule.LINERULE_EXACT,
minValue: 0.03,
step: 0.01,
defaultUnit: "cm"
}];
this.cmbLineRule = new Common.UI.ComboBox({
el: $("#paragraph-combo-line-rule"),
cls: "input-group-nr",
menuStyle: "min-width: 85px;",
editable: false,
data: this._arrLineRule
});
this.cmbLineRule.setValue(this._arrLineRule[this._state.LineRuleIdx].value);
this.lockedControls.push(this.cmbLineRule);
this.numLineHeight = new Common.UI.MetricSpinner({
el: $("#paragraph-spin-line-height"),
step: 0.01,
width: 85,
value: "1.5",
defaultUnit: "",
maxValue: 132,
minValue: 0.5
});
this.lockedControls.push(this.numLineHeight);
this.numSpacingBefore = new Common.UI.MetricSpinner({
el: $("#paragraph-spin-spacing-before"),
step: 0.1,
width: 85,
value: "0 cm",
defaultUnit: "cm",
maxValue: 55.88,
minValue: 0,
allowAuto: true,
autoText: this.txtAutoText
});
this.spinners.push(this.numSpacingBefore);
this.lockedControls.push(this.numSpacingBefore);
this.numSpacingAfter = new Common.UI.MetricSpinner({
el: $("#paragraph-spin-spacing-after"),
step: 0.1,
width: 85,
value: "0.35 cm",
defaultUnit: "cm",
maxValue: 55.88,
minValue: 0,
allowAuto: true,
autoText: this.txtAutoText
});
this.spinners.push(this.numSpacingAfter);
this.lockedControls.push(this.numSpacingAfter);
this.numLineHeight.on("change", _.bind(this.onNumLineHeightChange, this));
this.numSpacingBefore.on("change", _.bind(this.onNumSpacingBeforeChange, this));
this.numSpacingAfter.on("change", _.bind(this.onNumSpacingAfterChange, this));
this.cmbLineRule.on("selected", _.bind(this.onLineRuleSelect, this));
this.cmbLineRule.on("hide:after", _.bind(this.onHideMenus, this));
$(this.el).on("click", "#paragraph-advanced-link", _.bind(this.openAdvancedSettings, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
scope: this
}));
this.linkAdvanced = $("#paragraph-advanced-link");
},
setApi: function (api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback("asc_onParaSpacingLine", _.bind(this._onLineSpacing, this));
}
return this;
},
onNumLineHeightChange: function (field, newValue, oldValue, eOpts) {
if (this.cmbLineRule.getRawValue() === "") {
return;
}
var type = c_paragraphLinerule.LINERULE_AUTO;
if (this.api) {
this.api.asc_putPrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue() == c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
Common.NotificationCenter.trigger("edit:complete", this);
},
onNumSpacingBeforeChange: function (field, newValue, oldValue, eOpts) {
if (this.api) {
var num = field.getNumberValue();
if (num < 0) {
this.api.asc_putLineSpacingBeforeAfter(0, -1);
} else {
this.api.asc_putLineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
}
Common.NotificationCenter.trigger("edit:complete", this);
},
onNumSpacingAfterChange: function (field, newValue, oldValue, eOpts) {
if (this.api) {
var num = field.getNumberValue();
if (num < 0) {
this.api.asc_putLineSpacingBeforeAfter(1, -1);
} else {
this.api.asc_putLineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
}
Common.NotificationCenter.trigger("edit:complete", this);
},
onLineRuleSelect: function (combo, record) {
if (this.api) {
this.api.asc_putPrLineSpacing(record.value, record.defaultValue);
}
this.numLineHeight.setDefaultUnit(this._arrLineRule[record.value].defaultUnit);
this.numLineHeight.setMinValue(this._arrLineRule[record.value].minValue);
this.numLineHeight.setStep(this._arrLineRule[record.value].step);
Common.NotificationCenter.trigger("edit:complete", this);
},
_onLineSpacing: function (value) {
var linerule = value.asc_getLineRule();
var line = value.asc_getLine();
if (this._state.LineRuleIdx !== linerule) {
this.cmbLineRule.setValue((linerule !== null) ? this._arrLineRule[linerule].value : "");
this.numLineHeight.setMinValue(this._arrLineRule[(linerule !== null) ? linerule : 1].minValue);
this.numLineHeight.setDefaultUnit(this._arrLineRule[(linerule !== null) ? linerule : 1].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[(linerule !== null) ? linerule : 1].step);
this._state.LineRuleIdx = linerule;
}
if (Math.abs(this._state.LineHeight - line) > 0.001 || (this._state.LineHeight === null || line === null) && (this._state.LineHeight !== line)) {
var val = "";
if (linerule == c_paragraphLinerule.LINERULE_AUTO) {
val = line;
} else {
if (linerule !== null && line !== null) {
val = Common.Utils.Metric.fnRecalcFromMM(line);
}
}
this.numLineHeight.setValue((val !== null) ? val : "", true);
this._state.LineHeight = line;
}
},
ChangeSettings: function (prop) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
this.disableControls(this._locked);
if (prop) {
var Spacing = {
Line: prop.asc_getSpacing().asc_getLine(),
Before: prop.asc_getSpacing().asc_getBefore(),
After: prop.asc_getSpacing().asc_getAfter(),
LineRule: prop.asc_getSpacing().asc_getLineRule()
};
if (this._state.LineRuleIdx !== Spacing.LineRule) {
this.cmbLineRule.setValue((Spacing.LineRule !== null) ? this._arrLineRule[Spacing.LineRule].value : "");
this.numLineHeight.setMinValue(this._arrLineRule[(Spacing.LineRule !== null) ? Spacing.LineRule : 1].minValue);
this.numLineHeight.setDefaultUnit(this._arrLineRule[(Spacing.LineRule !== null) ? Spacing.LineRule : 1].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[(Spacing.LineRule !== null) ? Spacing.LineRule : 1].step);
this._state.LineRuleIdx = Spacing.LineRule;
}
if (Math.abs(this._state.LineHeight - Spacing.Line) > 0.001 || (this._state.LineHeight === null || Spacing.Line === null) && (this._state.LineHeight !== Spacing.Line)) {
var val = "";
if (Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO) {
val = Spacing.Line;
} else {
if (Spacing.LineRule !== null && Spacing.Line !== null) {
val = Common.Utils.Metric.fnRecalcFromMM(Spacing.Line);
}
}
this.numLineHeight.setValue((val !== null) ? val : "", true);
this._state.LineHeight = Spacing.Line;
}
if (Math.abs(this._state.LineSpacingBefore - Spacing.Before) > 0.001 || (this._state.LineSpacingBefore === null || Spacing.Before === null) && (this._state.LineSpacingBefore !== Spacing.Before)) {
this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before < 0) ? Spacing.Before : Common.Utils.Metric.fnRecalcFromMM(Spacing.Before)) : "", true);
this._state.LineSpacingBefore = Spacing.Before;
}
if (Math.abs(this._state.LineSpacingAfter - Spacing.After) > 0.001 || (this._state.LineSpacingAfter === null || Spacing.After === null) && (this._state.LineSpacingAfter !== Spacing.After)) {
this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After < 0) ? Spacing.After : Common.Utils.Metric.fnRecalcFromMM(Spacing.After)) : "", true);
this._state.LineSpacingAfter = Spacing.After;
}
}
},
updateMetricUnit: function () {
if (this.spinners) {
for (var i = 0; i < this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}
this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineRule[2].step = this._arrLineRule[0].step = (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm) ? 0.01 : 1;
if (this._state.LineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[this._state.LineRuleIdx].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[this._state.LineRuleIdx].step);
}
},
createDelayedElements: function () {
this.updateMetricUnit();
},
openAdvancedSettings: function (e) {
if (this.linkAdvanced.hasClass("disabled")) {
return;
}
var me = this;
var win;
if (me.api && !this._locked) {
var selectedElements = me.api.asc_getGraphicObjectProps();
if (selectedElements && selectedElements.length > 0) {
var elType, elValue;
for (var i = selectedElements.length - 1; i >= 0; i--) {
elType = selectedElements[i].asc_getObjectType();
elValue = selectedElements[i].asc_getObjectValue();
if (c_oAscTypeSelectElement.Paragraph == elType) {
(new SSE.Views.ParagraphSettingsAdvanced({
paragraphProps: elValue,
api: me.api,
handler: function (result, value) {
if (result == "ok") {
if (me.api) {
me.borderAdvancedProps = value.borderProps;
me.api.asc_setGraphicObjectProps(value.paragraphProps);
}
}
Common.NotificationCenter.trigger("edit:complete", me);
}
})).show();
break;
}
}
}
}
},
onHideMenus: function (e) {
Common.NotificationCenter.trigger("edit:complete", this);
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function (disable) {
if (this._state.DisabledControls !== disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function (item) {
item.setDisabled(disable);
});
this.linkAdvanced.toggleClass("disabled", disable);
}
},
strParagraphSpacing: "Spacing",
strLineHeight: "Line Spacing",
strSpacingBefore: "Before",
strSpacingAfter: "After",
textAuto: "Multiple",
textAtLeast: "At least",
textExact: "Exactly",
textAdvanced: "Show advanced settings",
textAt: "At",
txtAutoText: "Auto"
},
SSE.Views.ParagraphSettings || {}));
});

View File

@@ -1,579 +1,266 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.PrintSettings", {
extend: "Ext.window.Window",
alias: "widget.sseprintsettings",
requires: ["Ext.window.Window", "Ext.form.field.ComboBox", "Ext.form.RadioGroup", "Ext.Array", "Common.component.MetricSpinner", "Common.component.IndeterminateCheckBox"],
cls: "asc-advanced-settings-window",
modal: true,
resizable: false,
plain: true,
constrain: true,
height: 588,
width: 466,
layout: {
type: "vbox",
align: "stretch"
},
initComponent: function () {
var me = this;
this.addEvents("onmodalresult");
this._spacer = Ext.create("Ext.toolbar.Spacer", {
width: "100%",
height: 10,
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
});
this.cmbPaperSize = Ext.widget("combo", {
store: Ext.create("Ext.data.Store", {
fields: ["description", "size"],
data: [{
size: "215.9|279.4",
description: "US Letter (21,59cm x 27,94cm)"
},
{
size: "215.9|355.6",
description: "US Legal (21,59cm x 35,56cm)"
},
{
size: "210|297",
description: "A4 (21cm x 29,7cm)"
},
{
size: "148.1|209.9",
description: "A5 (14,81cm x 20,99cm)"
},
{
size: "176|250.1",
description: "B5 (17,6cm x 25,01cm)"
},
{
size: "104.8|241.3",
description: "Envelope #10 (10,48cm x 24,13cm)"
},
{
size: "110.1|220.1",
description: "Envelope DL (11,01cm x 22,01cm)"
},
{
size: "279.4|431.7",
description: "Tabloid (27,94cm x 43,17cm)"
},
{
size: "297|420.1",
description: "A3 (29,7cm x 42,01cm)"
},
{
size: "304.8|457.1",
description: "Tabloid Oversize (30,48cm x 45,71cm)"
},
{
size: "196.8|273",
description: "ROC 16K (19,68cm x 27,3cm)"
},
{
size: "119.9|234.9",
description: "Envelope Choukei 3 (11,99cm x 23,49cm)"
},
{
size: "330.2|482.5",
description: "Super B/A3 (33,02cm x 48,25cm)"
}]
}),
displayField: "description",
valueField: "size",
queryMode: "local",
editable: false,
flex: 1
});
this.cmbPaperOrientation = Ext.widget("combo", {
store: Ext.create("Ext.data.Store", {
fields: ["description", "orient"],
data: [{
description: me.strPortrait,
orient: c_oAscPageOrientation.PagePortrait
},
{
description: me.strLandscape,
orient: c_oAscPageOrientation.PageLandscape
}]
}),
displayField: "description",
valueField: "orient",
queryMode: "local",
editable: false,
width: 115
});
this.chPrintGrid = Ext.widget("cmdindeterminatecheckbox", {
boxLabel: this.textPrintGrid
});
this.chPrintRows = Ext.widget("cmdindeterminatecheckbox", {
boxLabel: this.textPrintHeadings
});
this.spnMarginLeft = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0.19 cm",
listeners: {
change: Ext.bind(function (field, newValue, oldValue, eOpts) {},
this)
}
});
this.spnMarginRight = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0.19 cm",
listeners: {
change: function (field, newValue, oldValue, eOpts) {}
}
});
this.spnMarginTop = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0 cm",
listeners: {
change: function (field, newValue, oldValue, eOpts) {}
}
});
this.spnMarginBottom = Ext.create("Common.component.MetricSpinner", {
readOnly: false,
maxValue: 48.25,
minValue: 0,
step: 0.1,
defaultUnit: "cm",
value: "0 cm",
listeners: {
change: function (field, newValue, oldValue, eOpts) {}
}
});
this.items = [this.topCnt = Ext.widget("container", {
height: 490,
layout: {
type: "hbox",
align: "stretch"
},
items: [{
xtype: "container",
width: 160,
padding: "18 0 0 0",
layout: {
type: "vbox",
align: "stretch"
},
defaults: {
xtype: "container",
padding: "0 10 0 0",
layout: {
type: "hbox",
align: "middle",
pack: "end"
}
},
items: [{
height: 80,
padding: "0 10px 10px 0",
items: [{
xtype: "label",
text: me.textPrintRange,
style: "font-weight: bold;"
}]
},
{
height: 62,
items: [{
xtype: "label",
text: me.textPageSize,
style: "font-weight: bold;"
}]
},
{
height: 58,
items: [{
xtype: "label",
text: me.textPageOrientation,
style: "font-weight: bold;"
}]
},
{
height: 124,
items: [{
xtype: "label",
text: this.strMargins,
style: "font-weight: bold;"
}]
},
{
height: 68,
items: [{
xtype: "label",
text: me.textLayout,
style: "font-weight: bold;"
}]
},
{
height: 70,
items: [{
xtype: "label",
text: me.strPrint,
style: "font-weight: bold;"
}]
}]
},
{
xtype: "box",
cls: "advanced-settings-separator",
height: "100%",
width: 8
},
{
xtype: "container",
padding: "18 0 0 10",
width: 280,
layout: {
type: "vbox",
align: "stretch"
},
items: [{
xtype: "container",
height: 70,
padding: "0 10",
layout: {
type: "hbox",
align: "middle"
},
items: [this.groupRange = Ext.widget("radiogroup", {
id: "dialog-printoptions-grouprange",
columns: 1,
width: 280,
vertical: true,
items: [{
boxLabel: this.textCurrentSheet,
name: "printrange",
inputValue: c_oAscPrintType.ActiveSheets,
checked: true
},
{
boxLabel: this.textAllSheets,
name: "printrange",
inputValue: c_oAscPrintType.EntireWorkbook
},
{
boxLabel: this.textSelection,
name: "printrange",
inputValue: c_oAscPrintType.Selection
}]
})]
},
this._spacer.cloneConfig({
style: "margin: 15px 0 10px 0;",
height: 6
}), {
xtype: "container",
height: 25,
padding: "0 10",
layout: {
type: "hbox",
align: "middle"
},
items: [this.cmbPaperSize]
},
this._spacer.cloneConfig({
style: "margin: 17px 0 10px 0;",
height: 6
}), {
xtype: "container",
height: 25,
padding: "0 10",
layout: {
type: "hbox",
align: "middle"
},
items: [this.cmbPaperOrientation]
},
this._spacer.cloneConfig({
style: "margin: 16px 0 4px 0;",
height: 6
}), this.cntMargins = Ext.widget("container", {
height: 100,
padding: "0 10",
layout: {
type: "hbox"
},
defaults: {
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
height: 100
},
items: [{
flex: 1,
items: [{
xtype: "label",
width: "100%",
text: me.strTop
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginTop, {
xtype: "tbspacer",
height: 12
},
{
xtype: "label",
width: "100%",
text: me.strLeft
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginLeft]
},
{
xtype: "tbspacer",
width: 20
},
{
flex: 1,
items: [{
xtype: "label",
text: me.strBottom,
width: "100%"
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginBottom, {
xtype: "tbspacer",
height: 12
},
{
xtype: "label",
text: me.strRight,
width: "100%"
},
{
xtype: "tbspacer",
height: 3
},
this.spnMarginRight]
}]
}), this._spacer.cloneConfig({
style: "margin: 14px 0 6px 0;",
height: 6
}), this.cntLayout = Ext.widget("container", {
height: 45,
padding: "0 10",
layout: {
type: "vbox",
align: "stretch"
},
items: [this.groupLayout = Ext.widget("radiogroup", {
columns: 1,
width: 280,
vertical: true,
items: [{
boxLabel: this.textActualSize,
name: "printlayout",
inputValue: c_oAscLayoutPageType.ActualSize
},
{
boxLabel: this.textFit,
name: "printlayout",
inputValue: c_oAscLayoutPageType.FitToWidth,
checked: true
}]
})]
}), this._spacer.cloneConfig({
style: "margin: 14px 0 8px 0;",
height: 6
}), this.cntAdditional = Ext.widget("container", {
height: 65,
padding: "0 10",
layout: {
type: "vbox",
align: "stretch"
},
items: [this.chPrintGrid, this.chPrintRows]
})]
}]
}), this._spacer.cloneConfig({
style: "margin: 0 18px"
}), {
xtype: "container",
height: 40,
layout: {
type: "vbox",
align: "center",
pack: "center"
},
items: [{
xtype: "container",
width: 466,
height: 24,
style: "padding: 0 30px;",
layout: {
type: "hbox",
align: "stretch"
},
items: [{
xtype: "button",
width: 100,
height: 22,
text: this.textHideDetails,
listeners: {
scope: this,
click: this.handlerShowDetails
}
},
this.btnOk = Ext.widget("button", {
id: "dialog-print-options-ok",
cls: "asc-blue-button",
width: 150,
height: 22,
style: "margin:0 10px 0 60px;",
text: this.btnPrint,
listeners: {}
}), this.btnCancel = Ext.widget("button", {
cls: "asc-darkgray-button",
width: 86,
height: 22,
text: this.cancelButtonText,
listeners: {
click: function (btn) {
this.fireEvent("onmodalresult", this, 0);
this.close();
},
scope: this
}
})]
}]
}];
this.callParent(arguments);
this.setTitle(this.textTitle);
},
afterRender: function () {
this.callParent(arguments);
},
checkMargins: function () {
if (this.cmbPaperOrientation.getValue() == c_oAscPageOrientation.PagePortrait) {
var pagewidth = /^\d{3}\.?\d*/.exec(this.cmbPaperSize.getValue());
var pageheight = /\d{3}\.?\d*$/.exec(this.cmbPaperSize.getValue());
} else {
pageheight = /^\d{3}\.?\d*/.exec(this.cmbPaperSize.getValue());
pagewidth = /\d{3}\.?\d*$/.exec(this.cmbPaperSize.getValue());
}
var ml = Common.MetricSettings.fnRecalcToMM(this.spnMarginLeft.getNumberValue());
var mr = Common.MetricSettings.fnRecalcToMM(this.spnMarginRight.getNumberValue());
var mt = Common.MetricSettings.fnRecalcToMM(this.spnMarginTop.getNumberValue());
var mb = Common.MetricSettings.fnRecalcToMM(this.spnMarginBottom.getNumberValue());
if (ml > pagewidth) {
return "left";
}
if (mr > pagewidth - ml) {
return "right";
}
if (mt > pageheight) {
return "top";
}
if (mb > pageheight - mt) {
return "bottom";
}
return null;
},
handlerShowDetails: function (btn) {
if (!this.extended) {
this.extended = true;
this.cntMargins.setDisabled(true);
this.cntLayout.setDisabled(true);
this.cntAdditional.setDisabled(true);
this.topCnt.setHeight(218);
this.setHeight(316);
btn.setText(this.textShowDetails);
} else {
this.extended = false;
this.cntMargins.setDisabled(false);
this.cntLayout.setDisabled(false);
this.cntAdditional.setDisabled(false);
this.topCnt.setHeight(490);
this.setHeight(588);
btn.setText(this.textHideDetails);
}
},
updateMetricUnit: function () {
var spinners = this.query("commonmetricspinner");
if (spinners) {
for (var i = 0; i < spinners.length; i++) {
var spinner = spinners[i];
spinner.setDefaultUnit(Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
spinner.setStep(Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
textTitle: "Print Settings",
strLeft: "Left",
strRight: "Right",
strTop: "Top",
strBottom: "Bottom",
strPortrait: "Portrait",
strLandscape: "Landscape",
textPrintGrid: "Print Gridlines",
textPrintHeadings: "Print Rows and Columns Headings",
textPageSize: "Page Size",
textPageOrientation: "Page Orientation",
strMargins: "Margins",
strPrint: "Print",
btnPrint: "Save & Print",
textPrintRange: "Print Range",
textLayout: "Layout",
textCurrentSheet: "Current Sheet",
textAllSheets: "All Sheets",
textSelection: "Selection",
textActualSize: "Actual Size",
textFit: "Fit to width",
textShowDetails: "Show Details",
cancelButtonText: "Cancel",
textHideDetails: "Hide Details"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/PrintSettings.template", "common/main/lib/view/AdvancedSettingsWindow", "common/main/lib/component/MetricSpinner", "common/main/lib/component/CheckBox", "common/main/lib/component/RadioBox", "common/main/lib/component/ListView"], function (contentTemplate) {
SSE.Views.PrintSettings = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
alias: "PrintSettings",
contentWidth: 280,
height: 482
},
initialize: function (options) {
_.extend(this.options, {
title: this.textTitle,
template: ['<div class="box" style="height:' + (this.options.height - 85) + 'px;">', '<div class="menu-panel" style="overflow: hidden;">', '<div style="height: 90px; line-height: 90px;" class="div-category">' + this.textPrintRange + "</div>", '<div style="height: 55px; line-height: 55px;" class="div-category">' + this.textPageSize + "</div>", '<div style="height: 55px; line-height: 55px;" class="div-category">' + this.textPageOrientation + "</div>", '<div style="height: 122px; line-height: 122px;" class="div-category">' + this.strMargins + "</div>", '<div style="height: 73px; line-height: 73px;" class="div-category">' + this.strPrint + "</div>", "</div>", '<div class="separator"/>', '<div class="content-panel">' + _.template(contentTemplate)({
scope: this
}) + "</div>", "</div>", '<div class="separator horizontal"/>', '<div class="footer justify">', '<button id="printadv-dlg-btn-hide" class="btn btn-text-default" style="margin-right: 55px; width: 100px;">' + this.textHideDetails + "</button>", '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 150px;">' + this.btnPrint + "</button>", '<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.cancelButtonText + "</button>", "</div>"].join("")
},
options);
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
this.spinners = [];
},
render: function () {
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
this.radioCurrent = new Common.UI.RadioBox({
el: $("#printadv-dlg-radio-current"),
labelText: this.textCurrentSheet,
name: "asc-radio-printrange",
checked: true
});
this.radioCurrent.on("change", _.bind(this.onRadioRangeChange, this));
this.radioAll = new Common.UI.RadioBox({
el: $("#printadv-dlg-radio-all"),
labelText: this.textAllSheets,
name: "asc-radio-printrange"
});
this.radioAll.on("change", _.bind(this.onRadioRangeChange, this));
this.radioSelection = new Common.UI.RadioBox({
el: $("#printadv-dlg-radio-selection"),
labelText: this.textSelection,
name: "asc-radio-printrange"
});
this.radioSelection.on("change", _.bind(this.onRadioRangeChange, this));
this.cmbPaperSize = new Common.UI.ComboBox({
el: $("#printadv-dlg-combo-pages"),
style: "width: 260px;",
menuStyle: "max-height: 280px; min-width: 260px;",
editable: false,
cls: "input-group-nr",
data: [{
value: "215.9|279.4",
displayValue: "US Letter (21,59cm x 27,94cm)"
},
{
value: "215.9|355.6",
displayValue: "US Legal (21,59cm x 35,56cm)"
},
{
value: "210|297",
displayValue: "A4 (21cm x 29,7cm)"
},
{
value: "148.1|209.9",
displayValue: "A5 (14,81cm x 20,99cm)"
},
{
value: "176|250.1",
displayValue: "B5 (17,6cm x 25,01cm)"
},
{
value: "104.8|241.3",
displayValue: "Envelope #10 (10,48cm x 24,13cm)"
},
{
value: "110.1|220.1",
displayValue: "Envelope DL (11,01cm x 22,01cm)"
},
{
value: "279.4|431.7",
displayValue: "Tabloid (27,94cm x 43,17cm)"
},
{
value: "297|420.1",
displayValue: "A3 (29,7cm x 42,01cm)"
},
{
value: "304.8|457.1",
displayValue: "Tabloid Oversize (30,48cm x 45,71cm)"
},
{
value: "196.8|273",
displayValue: "ROC 16K (19,68cm x 27,3cm)"
},
{
value: "119.9|234.9",
displayValue: "Envelope Choukei 3 (11,99cm x 23,49cm)"
},
{
value: "330.2|482.5",
displayValue: "Super B/A3 (33,02cm x 48,25cm)"
}]
});
this.cmbPaperOrientation = new Common.UI.ComboBox({
el: $("#printadv-dlg-combo-orient"),
style: "width: 115px;",
menuStyle: "min-width: 115px;",
editable: false,
cls: "input-group-nr",
data: [{
value: c_oAscPageOrientation.PagePortrait,
displayValue: this.strPortrait
},
{
value: c_oAscPageOrientation.PageLandscape,
displayValue: this.strLandscape
}]
});
this.chPrintGrid = new Common.UI.CheckBox({
el: $("#printadv-dlg-chb-grid"),
labelText: this.textPrintGrid
});
this.chPrintRows = new Common.UI.CheckBox({
el: $("#printadv-dlg-chb-rows"),
labelText: this.textPrintHeadings
});
this.spnMarginTop = new Common.UI.MetricSpinner({
el: $("#printadv-dlg-spin-margin-top"),
step: 0.1,
width: 115,
defaultUnit: "cm",
value: "0 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginTop);
this.spnMarginBottom = new Common.UI.MetricSpinner({
el: $("#printadv-dlg-spin-margin-bottom"),
step: 0.1,
width: 115,
defaultUnit: "cm",
value: "0 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginBottom);
this.spnMarginLeft = new Common.UI.MetricSpinner({
el: $("#printadv-dlg-spin-margin-left"),
step: 0.1,
width: 115,
defaultUnit: "cm",
value: "0.19 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginLeft);
this.spnMarginRight = new Common.UI.MetricSpinner({
el: $("#printadv-dlg-spin-margin-right"),
step: 0.1,
width: 115,
defaultUnit: "cm",
value: "0.19 cm",
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnMarginRight);
this.btnHide = new Common.UI.Button({
el: $("#printadv-dlg-btn-hide")
});
this.btnHide.on("click", _.bind(this.handlerShowDetails, this));
this.panelDetails = $("#printadv-dlg-content-to-hide");
this.updateMetricUnit();
this.options.afterrender && this.options.afterrender.call(this);
},
setRange: function (value) {
(value == c_oAscPrintType.ActiveSheets) ? this.radioCurrent.setValue(true) : ((value == c_oAscPrintType.EntireWorkbook) ? this.radioAll.setValue(true) : this.radioSelection.setValue(true));
},
setLayout: function (value) {},
getRange: function () {
return (this.radioCurrent.getValue() ? c_oAscPrintType.ActiveSheets : (this.radioAll.getValue() ? c_oAscPrintType.EntireWorkbook : c_oAscPrintType.Selection));
},
getLayout: function () {},
onRadioRangeChange: function (radio, newvalue) {
if (newvalue) {
this.fireEvent("changerange", this);
}
},
updateMetricUnit: function () {
if (this.spinners) {
for (var i = 0; i < this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}
},
handlerShowDetails: function (btn) {
if (!this.extended) {
this.extended = true;
this.panelDetails.css({
"display": "none"
});
this.setHeight(286);
btn.setCaption(this.textShowDetails);
} else {
this.extended = false;
this.panelDetails.css({
"display": "block"
});
this.setHeight(482);
btn.setCaption(this.textHideDetails);
}
},
textTitle: "Print Settings",
strLeft: "Left",
strRight: "Right",
strTop: "Top",
strBottom: "Bottom",
strPortrait: "Portrait",
strLandscape: "Landscape",
textPrintGrid: "Print Gridlines",
textPrintHeadings: "Print Rows and Columns Headings",
textPageSize: "Page Size",
textPageOrientation: "Page Orientation",
strMargins: "Margins",
strPrint: "Print",
btnPrint: "Save & Print",
textPrintRange: "Print Range",
textLayout: "Layout",
textCurrentSheet: "Current Sheet",
textAllSheets: "All Sheets",
textSelection: "Selection",
textActualSize: "Actual Size",
textFit: "Fit to width",
textShowDetails: "Show Details",
cancelButtonText: "Cancel",
textHideDetails: "Hide Details"
},
SSE.Views.PrintSettings || {}));
});

View File

@@ -1,75 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.RecentFiles", {
extend: "Ext.panel.Panel",
alias: "widget.sserecentfiles",
cls: "sse-recentfiles",
layout: {
type: "vbox",
align: "stretch"
},
requires: ["Ext.container.Container", "Ext.data.Model", "Ext.data.Store", "Ext.view.View", "Ext.XTemplate", "Common.plugin.DataViewScrollPane"],
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
this.callParent(arguments);
var me = this;
me.add({
xtype: "container",
flex: 1,
layout: "fit",
cls: "container-recent-file-list",
items: [{
xtype: "dataview",
store: "RecentFiles",
tpl: Ext.create("Ext.XTemplate", '<tpl for=".">', '<div class="thumb-wrap">', '<div class="thumb"></div>', '<div class="file-name">{title:htmlEncode}</div>', '<div class="file-info">{folder:htmlEncode}</div>', "</div>", "</tpl>"),
singleSelect: true,
trackOver: true,
style: "overflow:auto",
overItemCls: "x-item-over",
itemSelector: "div.thumb-wrap",
cls: "x-view-context",
plugins: [{
ptype: "dataviewscrollpane",
pluginId: "scrollpane",
areaSelector: ".x-view-context",
settings: {
enableKeyboardNavigation: true
}
}]
}]
});
}
});

View File

@@ -1,231 +1,212 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var SCALE_MIN = 40;
var MENU_SCALE_PART = 260;
var RIGHTMENU_TOOLBAR_ID = "rightmenu-toolbar-id";
var RIGHTMENU_PANEL_ID = "rightmenu-panel-id";
Ext.define("SSE.view.RightMenu", {
extend: "Ext.panel.Panel",
alias: "widget.sserightmenu",
requires: ["Ext.toolbar.Toolbar", "Ext.button.Button", "Ext.container.Container", "Ext.toolbar.Spacer", "SSE.view.RightPanel", "Ext.util.Cookies"],
cls: "rm-style",
id: RIGHTMENU_PANEL_ID,
bodyCls: "rm-body",
width: SCALE_MIN,
buttonCollection: [],
listeners: {
afterrender: function () {
var owner = this.ownerCt;
if (Ext.isDefined(owner)) {
owner.addListener("resize", Ext.bind(this.resizeMenu, this));
}
}
},
initComponent: function () {
this.dockedItems = this.buildDockedItems();
this._rightSettings = Ext.widget("sserightpanel", {
id: "view-right-panel-settings",
btnImage: this.btnImage,
btnShape: this.btnShape,
btnText: this.btnText
});
this.items = [this._rightSettings];
this.addEvents("editcomplete");
this.callParent(arguments);
},
buildDockedItems: function () {
var me = this;
me.btnShape = Ext.create("Ext.button.Button", {
id: "id-right-menu-shape",
cls: "asc-main-menu-buttons",
iconCls: "asc-main-menu-btn menuShape",
asctype: c_oAscTypeSelectElement.Shape,
enableToggle: true,
allowDepress: true,
toggleGroup: "tabpanelbtnsGroup",
disabled: true,
style: "margin-bottom:8px;"
});
me.btnImage = Ext.create("Ext.Button", {
id: "id-right-menu-image",
cls: "asc-main-menu-buttons",
iconCls: "asc-main-menu-btn menuImage",
asctype: c_oAscTypeSelectElement.Image,
enableToggle: true,
allowDepress: true,
toggleGroup: "tabpanelbtnsGroup",
disabled: true,
style: "margin-bottom:8px;"
});
me.btnText = Ext.create("Ext.Button", {
id: "id-right-menu-text",
cls: "asc-main-menu-buttons",
iconCls: "asc-main-menu-btn menuText",
asctype: c_oAscTypeSelectElement.Paragraph,
enableToggle: true,
allowDepress: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.rightToolbar = Ext.create("Ext.toolbar.Toolbar", {
cls: "rm-default-toolbar",
width: this.width || SCALE_MIN,
vertical: true,
dock: "right",
defaultType: "button",
style: "padding-top:15px",
items: [me.btnShape, me.btnImage, me.btnText]
});
return this.rightToolbar;
},
resizeMenu: function (Component, adjWidth, adjHeight, eOpts) {
for (var i = 0; i < this.items.length; i++) {
if (this.items.items[i].el && adjHeight != this.items.items[i].getHeight()) {
this.items.items[i].setHeight(adjHeight);
}
}
this.doComponentLayout();
},
setApi: function (o) {
this.api = o;
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
return this;
},
disableMenu: function (disabled) {
var btn, i;
var tbMain = this.rightToolbar;
if (Ext.isDefined(tbMain)) {
for (i = 0; i < tbMain.items.length; i++) {
btn = tbMain.items.items[i];
if (btn) {
btn.pressed && btn.toggle(false);
btn.setDisabled(disabled);
}
}
}
},
onCoAuthoringDisconnect: function () {
this.disableMenu(true);
if (this._rightSettings) {
this._rightSettings.setDisabled(true);
this._rightSettings.setMode({
isEdit: false
});
}
},
onSelectionChanged: function (info) {
var SelectedObjects = [];
if (info.asc_getFlags().asc_getSelectionType() == c_oAscSelectionType.RangeImage || info.asc_getFlags().asc_getSelectionType() == c_oAscSelectionType.RangeShape || info.asc_getFlags().asc_getSelectionType() == c_oAscSelectionType.RangeShapeText) {
SelectedObjects = this.api.asc_getGraphicObjectProps();
}
if (SelectedObjects.length <= 0 && !this._rightSettings.minimizedMode) {
this.clearSelection();
this._rightSettings.minimizedMode = true;
this.setWidth(SCALE_MIN);
}
this._rightSettings.onFocusObject(SelectedObjects);
},
clearSelection: function (exclude) {
var btn, i;
var tbMain = this.rightToolbar;
if (Ext.isDefined(tbMain)) {
for (i = 0; i < tbMain.items.length; i++) {
btn = tbMain.items.items[i];
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
if (btn.pressed) {
if (exclude) {
if (typeof exclude == "object") {
if (exclude.id == btn.id) {
continue;
}
} else {
if (btn.iconCls && !(btn.iconCls.search(exclude) < 0)) {
continue;
}
}
}
btn.toggle(false);
}
}
}
}
},
createDelayedElements: function () {
var me = this;
this.api.asc_registerCallback("asc_onSelectionChanged", Ext.bind(this.onSelectionChanged, this));
me._rightSettings.setHeight(me.getHeight());
var toggleHandler = function (btn, pressed) {
if (pressed && !me._rightSettings.minimizedMode) {
btn.addCls("asc-main-menu-btn-selected");
var panel = me._rightSettings._settings[btn.asctype].panel;
var props = me._rightSettings._settings[btn.asctype].props;
me._rightSettings.TabPanel.getLayout().setActiveItem(panel);
me._rightSettings.TabPanel.setHeight(panel.initialHeight);
if (props) {
panel.ChangeSettings.call(panel, props);
}
}
};
var clickHandler = function (btn) {
if (btn.pressed) {
if (me._rightSettings.minimizedMode) {
if (me._rightSettings.TabPanel.hidden) {
me._rightSettings.TabPanel.setVisible(true);
}
me.setWidth(MENU_SCALE_PART);
me._rightSettings.minimizedMode = false;
toggleHandler(btn, btn.pressed);
} else {
btn.addCls("asc-main-menu-btn-selected");
}
} else {
me._rightSettings.minimizedMode = true;
me.setWidth(SCALE_MIN);
btn.removeCls("asc-main-menu-btn-selected");
}
me.fireEvent("editcomplete", me);
};
var button;
var tips = [me.txtShapeSettings, me.txtImageSettings, me.txtParagraphSettings];
for (var i = this.rightToolbar.items.items.length; i--;) {
button = this.rightToolbar.items.items[i];
button.on({
"click": clickHandler,
"toggle": toggleHandler
});
button.setTooltip(tips[i]);
}
},
txtImageSettings: "Image Settings",
txtShapeSettings: "Shape Settings",
txtParagraphSettings: "Text Settings"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var SCALE_MIN = 40;
var MENU_SCALE_PART = 260;
define(["text!spreadsheeteditor/main/app/template/RightMenu.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/component/MetricSpinner", "common/main/lib/component/CheckBox", "spreadsheeteditor/main/app/view/ParagraphSettings", "spreadsheeteditor/main/app/view/ImageSettings", "spreadsheeteditor/main/app/view/ChartSettings", "spreadsheeteditor/main/app/view/ShapeSettings", "common/main/lib/component/Scroller"], function (menuTemplate, $, _, Backbone) {
SSE.Views.RightMenu = Backbone.View.extend(_.extend({
el: "#right-menu",
template: _.template(menuTemplate),
events: {},
initialize: function () {
this.minimizedMode = true;
this.btnText = new Common.UI.Button({
hint: this.txtParagraphSettings,
asctype: c_oAscTypeSelectElement.Paragraph,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnImage = new Common.UI.Button({
hint: this.txtImageSettings,
asctype: c_oAscTypeSelectElement.Image,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnChart = new Common.UI.Button({
hint: this.txtChartSettings,
asctype: c_oAscTypeSelectElement.Chart,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnShape = new Common.UI.Button({
hint: this.txtShapeSettings,
asctype: c_oAscTypeSelectElement.Shape,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this._settings = [];
this._settings[c_oAscTypeSelectElement.Paragraph] = {
panel: "id-paragraph-settings",
btn: this.btnText
};
this._settings[c_oAscTypeSelectElement.Image] = {
panel: "id-image-settings",
btn: this.btnImage
};
this._settings[c_oAscTypeSelectElement.Shape] = {
panel: "id-shape-settings",
btn: this.btnShape
};
this._settings[c_oAscTypeSelectElement.Chart] = {
panel: "id-chart-settings",
btn: this.btnChart
};
return this;
},
render: function () {
var el = $(this.el);
this.trigger("render:before", this);
el.css("width", "40px");
el.css("z-index", 101);
el.show();
el.html(this.template({}));
this.btnText.el = $("#id-right-menu-text");
this.btnText.render();
this.btnImage.el = $("#id-right-menu-image");
this.btnImage.render();
this.btnChart.el = $("#id-right-menu-chart");
this.btnChart.render();
this.btnShape.el = $("#id-right-menu-shape");
this.btnShape.render();
this.btnText.on("click", _.bind(this.onBtnMenuClick, this));
this.btnImage.on("click", _.bind(this.onBtnMenuClick, this));
this.btnChart.on("click", _.bind(this.onBtnMenuClick, this));
this.btnShape.on("click", _.bind(this.onBtnMenuClick, this));
this.paragraphSettings = new SSE.Views.ParagraphSettings();
this.imageSettings = new SSE.Views.ImageSettings();
this.chartSettings = new SSE.Views.ChartSettings();
this.shapeSettings = new SSE.Views.ShapeSettings();
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find(".right-panel"),
suppressScrollX: true,
useKeyboard: false
});
}
this.trigger("render:after", this);
return this;
},
setApi: function (api) {
this.api = api;
this.paragraphSettings.setApi(api);
this.imageSettings.setApi(api);
this.chartSettings.setApi(api);
this.shapeSettings.setApi(api);
},
setMode: function (mode) {},
onBtnMenuClick: function (btn, e) {
var target_pane = $("#" + this._settings[btn.options.asctype].panel);
var target_pane_parent = target_pane.parent();
if (btn.pressed) {
if (this.minimizedMode) {
$(this.el).width(MENU_SCALE_PART);
target_pane_parent.css("display", "inline-block");
this.minimizedMode = false;
window.localStorage.setItem("sse-hidden-right-settings", 0);
}
target_pane_parent.find("> .active").removeClass("active");
target_pane.addClass("active");
if (this.scroller) {
this.scroller.scrollTop(0);
}
} else {
target_pane_parent.css("display", "none");
$(this.el).width(SCALE_MIN);
this.minimizedMode = true;
window.localStorage.setItem("sse-hidden-right-settings", 1);
}
this.fireEvent("rightmenuclick", [this, btn.options.asctype, this.minimizedMode]);
},
SetActivePane: function (type, open) {
if (this.minimizedMode && open !== true || this._settings[type] === undefined) {
return;
}
if (this.minimizedMode) {
this._settings[type].btn.toggle(true, false);
this._settings[type].btn.trigger("click", this._settings[type].btn);
} else {
var target_pane = $("#" + this._settings[type].panel);
if (!target_pane.hasClass("active")) {
target_pane.parent().find("> .active").removeClass("active");
target_pane.addClass("active");
if (this.scroller) {
this.scroller.update();
}
}
if (!this._settings[type].btn.isActive()) {
this._settings[type].btn.toggle(true, false);
}
}
},
GetActivePane: function () {
return (this.minimizedMode) ? null : $(".settings-panel.active")[0].id;
},
SetDisabled: function (id, disabled, all) {
if (all) {
this.paragraphSettings.disableControls(disabled);
this.shapeSettings.disableControls(disabled);
this.imageSettings.disableControls(disabled);
this.chartSettings.disableControls(disabled);
} else {
var cmp = $("#" + id);
if (disabled !== cmp.hasClass("disabled")) {
cmp.toggleClass("disabled", disabled);
(disabled) ? cmp.attr({
disabled: disabled
}) : cmp.removeAttr("disabled");
}
}
},
clearSelection: function () {
var target_pane = $(".right-panel");
target_pane.find("> .active").removeClass("active");
_.each(this._settings, function (item) {
if (item.btn.isActive()) {
item.btn.toggle(false, true);
}
});
target_pane.css("display", "none");
$(this.el).width(SCALE_MIN);
this.minimizedMode = true;
window.localStorage.setItem("sse-hidden-right-settings", 1);
Common.NotificationCenter.trigger("layout:changed", "rightmenu");
},
txtParagraphSettings: "Paragraph Settings",
txtImageSettings: "Image Settings",
txtShapeSettings: "Shape Settings",
txtChartSettings: "Chart Settings"
},
SSE.Views.RightMenu || {}));
});

View File

@@ -1,262 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.RightPanel", {
extend: "Ext.container.Container",
alias: "widget.sserightpanel",
width: 220,
layout: {
type: "auto"
},
autoScroll: true,
cls: "asc-right-panel-container",
preventHeader: true,
requires: ["Ext.toolbar.Toolbar", "Ext.container.Container", "Common.plugin.ScrollPane", "SSE.view.ImageSettings", "SSE.view.ShapeSettings", "SSE.view.ParagraphSettings", "Ext.button.Button", "Ext.panel.Panel"],
uses: ["Ext.DomHelper", "Ext.util.Cookies"],
listeners: {
afterrender: function () {
var owner = this.ownerCt;
if (Ext.isDefined(owner)) {
owner.addListener("resize", Ext.bind(this.resizeRightPanels, this));
}
}
},
resizeRightPanels: function (cnt) {
this.doComponentLayout();
},
constructor: function (config) {
this.callParent(arguments);
this.initConfig(config);
return this;
},
initComponent: function () {
var me = this;
me.editMode = true;
me.minimizedMode = true;
me.plugins = [{
ptype: "scrollpane",
pluginId: "scrollpane",
areaSelector: ".x-container",
settings: {
enableKeyboardNavigation: true,
verticalGutter: 0
}
}];
me.callParent(arguments);
},
updateScrollPane: function () {
var me = this;
me.getPlugin("scrollpane").updateScrollPane();
},
onFocusObject: function (SelectedObjects) {
if (!this.editMode) {
return;
}
for (var i = 0; i < this._settings.length; i++) {
if (this._settings[i]) {
this._settings[i].hidden = 1;
}
}
for (i = 0; i < SelectedObjects.length; i++) {
var type = SelectedObjects[i].asc_getObjectType();
if (type >= this._settings.length || this._settings[type] === undefined) {
continue;
}
var value = SelectedObjects[i].asc_getObjectValue();
if (type == c_oAscTypeSelectElement.Image) {
if (value.asc_getShapeProperties() !== null) {
type = c_oAscTypeSelectElement.Shape;
}
}
this._settings[type].props = value;
this._settings[type].hidden = 0;
}
var lastactive = -1,
currentactive, priorityactive = -1;
for (i = 0; i < this._settings.length; i++) {
if (this._settings[i] === undefined) {
continue;
}
if (this._settings[i].hidden) {
if (!this._settings[i].btn.isDisabled()) {
this._settings[i].btn.setDisabled(true);
}
if (this.TabPanel.getLayout().getActiveItem() == this._settings[i].panel) {
currentactive = -1;
}
} else {
if (this._settings[i].btn.isDisabled()) {
this._settings[i].btn.setDisabled(false);
}
lastactive = i;
if (this._settings[i].needShow) {
this._settings[i].needShow = false;
priorityactive = i;
} else {
if (this.TabPanel.getLayout().getActiveItem() == this._settings[i].panel) {
currentactive = i;
}
}
}
}
if (!this.minimizedMode) {
var active;
if (priorityactive > -1) {
active = priorityactive;
} else {
if (lastactive >= 0 && currentactive < 0) {
active = lastactive;
} else {
if (currentactive >= 0) {
active = currentactive;
}
}
}
if (active !== undefined) {
if (!this._settings[active].btn.pressed) {
this._settings[active].btn.toggle();
} else {
if (this._settings[active].panel.ChangeSettings) {
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
}
}
}
}
this._settings[c_oAscTypeSelectElement.Image].needShow = false;
},
onInsertImage: function () {
this._settings[c_oAscTypeSelectElement.Image].needShow = true;
},
SendThemeColors: function (effectcolors, standartcolors) {
this.effectcolors = effectcolors;
if (standartcolors && standartcolors.length > 0) {
this.standartcolors = standartcolors;
}
if (this.ShapePanel) {
this.ShapePanel.SendThemeColors(effectcolors, standartcolors);
}
},
setApi: function (api) {
this.api = api;
return this;
},
setMode: function (mode) {
this.editMode = mode.isEdit;
},
FillAutoShapes: function () {
this.ShapePanel.FillAutoShapes();
},
hideMenus: function () {
for (var i = 0; i < this._settings.length; i++) {
if (this._settings[i] === undefined) {
continue;
}
if (Ext.isDefined(this._settings[i].panel.hideMenus)) {
this._settings[i].panel.hideMenus();
}
}
},
updateMetricUnit: function () {
this.ImagePanel.updateMetricUnit();
this.ParagraphPanel.updateMetricUnit();
},
_onSelectionChanged: function (info) {
var need_disable = info.asc_getLocked();
if (this._settings.prevDisabled != need_disable) {
this._settings.prevDisabled = need_disable;
this._settings.forEach(function (item) {
item.panel[need_disable ? "disable" : "enable"]();
});
}
},
createDelayedElements: function () {
var me = this;
me.panelHolder = Ext.create("Ext.container.Container", {
layout: {
type: "anchor"
},
items: [me.TabPanel = Ext.create("Ext.panel.Panel", {
hidden: true,
id: "view-tab-panel",
cls: "asc-right-tabpanel",
preventHeader: true,
layout: "card",
items: [me.ShapePanel = Ext.create("SSE.view.ShapeSettings", {
id: "view-shape-settings",
cls: "asc-right-panel",
type: c_oAscTypeSelectElement.Shape
}), me.ImagePanel = Ext.create("SSE.view.ImageSettings", {
id: "view-image-settings",
cls: "asc-right-panel",
type: c_oAscTypeSelectElement.Image
}), me.ParagraphPanel = Ext.create("SSE.view.ParagraphSettings", {
id: "view-paragraph-settings",
cls: "asc-right-panel",
type: c_oAscTypeSelectElement.Paragraph
})],
listeners: {
afterlayout: function () {
me.updateScrollPane();
}
}
})],
listeners: {
afterlayout: function () {
me.updateScrollPane();
}
}
});
me.add(me.panelHolder);
me.ShapePanel.setApi(me.api);
me.ImagePanel.setApi(me.api);
me.ParagraphPanel.setApi(me.api);
me.api.asc_registerCallback("asc_onSelectionChanged", Ext.bind(me._onSelectionChanged, me));
me._settings = [];
me._settings[c_oAscTypeSelectElement.Image] = {
panel: me.ImagePanel,
btn: me.btnImage,
hidden: 1
};
me._settings[c_oAscTypeSelectElement.Shape] = {
panel: me.ShapePanel,
btn: me.btnShape,
hidden: 1
};
me._settings[c_oAscTypeSelectElement.Paragraph] = {
panel: me.ParagraphPanel,
btn: me.btnText,
hidden: 1
};
if (this.effectcolors && this.standartcolors) {
this.ShapePanel.SendThemeColors(this.effectcolors, this.standartcolors);
}
}
});

View File

@@ -1,133 +1,97 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.SetValueDialog", {
extend: "Ext.window.Window",
alias: "widget.setvaluedialog",
requires: ["Ext.window.Window", "Ext.window.MessageBox"],
modal: true,
resizable: false,
plain: true,
height: 138,
width: 222,
padding: "20px",
layout: {
type: "vbox",
align: "stretch"
},
listeners: {
show: function () {
this.udRetValue.focus(false, 500);
}
},
initComponent: function () {
var me = this;
this.addEvents("onmodalresult");
this.items = [{
xtype: "container",
height: 42,
layout: {
type: "hbox",
align: "stretch"
},
items: [this.udRetValue = Ext.widget("numberfield", {
minValue: 0,
maxValue: me.maxvalue,
value: me.startvalue,
step: 1,
flex: 1,
allowDecimals: true,
validateOnBlur: false,
msgTarget: "side",
minText: this.txtMinText,
maxText: this.txtMaxText,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
me.btnOk.fireEvent("click");
} else {
if (e.getKey() == e.ESC) {
me.btnCancel.fireEvent("click");
}
}
}
}
})]
},
{
xtype: "container",
height: 30,
layout: {
type: "vbox",
align: "center"
},
items: [{
xtype: "container",
width: 182,
layout: {
type: "hbox",
align: "middle"
},
items: [this.btnOk = Ext.widget("button", {
cls: "asc-blue-button",
width: 86,
height: 22,
margin: "0 5px 0 0",
text: this.okButtonText,
listeners: {
click: function (btn) {
if (me.udRetValue.isValid()) {
me.fireEvent("onmodalresult", me, 1, me.udRetValue.value);
me.close();
}
}
}
}), this.btnCancel = Ext.widget("button", {
cls: "asc-darkgray-button",
width: 86,
height: 22,
text: this.cancelButtonText,
listeners: {
click: function (btn) {
me.fireEvent("onmodalresult", this, 0);
me.close();
}
}
})]
}]
}];
this.callParent(arguments);
},
cancelButtonText: "Cancel",
okButtonText: "Ok",
txtMinText: "The minimum value for this field is {0}",
txtMaxText: "The maximum value for this field is {0}"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["common/main/lib/component/Window", "common/main/lib/component/ComboBox"], function () {
SSE.Views.SetValueDialog = Common.UI.Window.extend(_.extend({
options: {
width: 214,
header: true,
style: "min-width: 214px;",
cls: "modal-dlg"
},
initialize: function (options) {
_.extend(this.options, {
title: this.textTitle
},
options || {});
this.template = ['<div class="box">', '<div class="input-row">', '<div id="id-spin-set-value"></div>', "</div>", '<div class="footer center">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + "</button>", '<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + "</button>", "</div>"].join("");
this.options.tpl = _.template(this.template, this.options);
this.startvalue = this.options.startvalue;
this.maxvalue = this.options.maxvalue;
this.defaultUnit = this.options.defaultUnit;
this.step = this.options.step;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
this.spnSize = new Common.UI.MetricSpinner({
el: $("#id-spin-set-value"),
width: 182,
step: this.step,
defaultUnit: this.defaultUnit,
minValue: 0,
maxValue: this.maxvalue,
value: this.startvalue + " " + this.defaultUnit
});
var $window = this.getChild();
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
this.spnSize.on("entervalue", _.bind(this.onEnterValue, this));
this.spnSize.on("change", _.bind(this.onChange, this));
this.spnSize.$el.find("input").focus();
},
_handleInput: function (state) {
if (this.options.handler) {
this.options.handler.call(this, this, state);
}
this.close();
},
onBtnClick: function (event) {
this._handleInput(event.currentTarget.attributes["result"].value);
},
onEnterValue: function (event) {
this._handleInput("ok");
},
onChange: function () {
var val = this.spnSize.getNumberValue();
val = val / this.step;
val = (val | val) * this.step;
this.spnSize.setValue(val, true);
},
getSettings: function () {
return this.spnSize.getNumberValue();
},
cancelButtonText: "Cancel",
okButtonText: "Ok",
txtMinText: "The minimum value for this field is {0}",
txtMaxText: "The maximum value for this field is {0}"
},
SSE.Views.SetValueDialog || {}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,152 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.SheetCopyDialog", {
extend: "Ext.window.Window",
alias: "widget.ssesheetcopydialog",
requires: ["Ext.window.Window", "Common.plugin.GridScrollPane"],
modal: true,
closable: true,
resizable: false,
plain: true,
height: 300,
width: 280,
padding: "20px",
layout: "vbox",
constrain: true,
layoutConfig: {
align: "stretch"
},
listeners: {
show: function () {
this.sheetList.getSelectionModel().select(0);
}
},
initComponent: function () {
var me = this;
var _btnOk = Ext.create("Ext.Button", {
id: "wscopydialog-button-ok",
text: Ext.Msg.buttonText.ok,
width: 80,
cls: "asc-blue-button",
listeners: {
click: function () {
me._modalresult = 1;
me.fireEvent("onmodalresult", me, me._modalresult, me.sheetList.getSelectionModel().selected.items[0].data.sheetindex);
me.close();
}
}
});
var _btnCancel = Ext.create("Ext.Button", {
id: "wscopydialog-button-cancel",
text: me.cancelButtonText,
width: 80,
cls: "asc-darkgray-button",
listeners: {
click: function () {
me._modalresult = 0;
me.fireEvent("onmodalresult", this, this._modalresult);
me.close();
}
}
});
Ext.define("worksheet", {
extend: "Ext.data.Model",
fields: [{
type: "int",
name: "sheetindex"
},
{
type: "string",
name: "name"
}]
});
this.sheetList = Ext.create("Ext.grid.Panel", {
activeItem: 0,
id: "wscopydialog-sheetlist-list",
scroll: false,
store: {
model: "worksheet",
data: this.names
},
columns: [{
flex: 1,
sortable: false,
dataIndex: "name"
}],
plugins: [{
ptype: "gridscrollpane"
}],
height: 160,
width: 240,
hideHeaders: true,
listeners: {
itemdblclick: function (o, record, item, index, e, eOpts) {
_btnOk.fireEvent("click", _btnOk);
}
}
});
this.items = [{
xtype: "label",
text: this.listtitle || this.labelList,
width: "100%",
style: "text-align:left"
},
{
xtype: "tbspacer",
height: 10
},
this.sheetList, {
xtype: "tbspacer",
height: 14
},
{
xtype: "container",
width: 240,
layout: "hbox",
layoutConfig: {
align: "stretch"
},
items: [{
xtype: "tbspacer",
flex: 1
},
_btnOk, {
xtype: "tbspacer",
width: 5
},
_btnCancel]
}];
this.callParent(arguments);
},
labelList: "Copy before sheet",
cancelButtonText: "Cancel"
});

View File

@@ -1,178 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.SheetRenameDialog", {
extend: "Ext.window.Window",
alias: "widget.ssesheetrenamedialog",
requires: ["Ext.window.Window"],
modal: true,
closable: true,
resizable: false,
preventHeader: true,
plain: true,
height: 116,
width: 280,
padding: "20px",
layout: "vbox",
constrain: true,
layoutConfig: {
align: "stretch"
},
listeners: {
show: function () {
this.txtName.focus(true, 100);
}
},
initComponent: function () {
this.addEvents("onmodalresult");
var me = this;
var checkName = function (n) {
var ac = me.names.length;
while (! (--ac < 0)) {
if (me.names[ac] == n) {
return ac == me.renameindex ? -255 : true;
}
}
return false;
};
var _btnOk = Ext.create("Ext.Button", {
id: "wsrenamedialog-button-ok",
text: Ext.Msg.buttonText.ok,
width: 80,
cls: "asc-blue-button",
listeners: {
click: function () {
if (
/*me.txtName.getValue().length ||*/
! me.txtName.isValid()) {} else {
var res = checkName(me.txtName.getValue());
if (res === true) {
Ext.Msg.show({
title: me.errTitle,
msg: me.errNameExists,
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK,
fn: function () {
me.txtName.focus(true, 500);
}
});
} else {
me._modalresult = res == -255 ? 0 : 1;
me.fireEvent("onmodalresult", me, me._modalresult, me.txtName.getValue());
me.close();
}
}
}
}
});
var _btnCancel = Ext.create("Ext.Button", {
id: "wsrenamedialog-button-cancel",
text: me.cancelButtonText,
width: 80,
cls: "asc-darkgray-button",
listeners: {
click: function () {
me._modalresult = 0;
me.fireEvent("onmodalresult", me, me._modalresult);
me.close();
}
}
});
this.txtName = Ext.create("Ext.form.Text", {
id: "wsrenamedialog-text-wsname",
width: 240,
msgTarget: "side",
validateOnBlur: false,
allowBlank: false,
value: this.names[this.renameindex],
enforceMaxLength: true,
maxLength: 31,
validator: function (value) {
if (value.length > 2 && value[0] == '"' && value[value.length - 1] == '"') {
return true;
}
if (!/[:\\\/\*\?\[\]\']/.test(value)) {
return true;
} else {
return me.errNameWrongChar;
}
},
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_btnOk.fireEvent("click");
} else {
if (e.getKey() == e.ESC) {
_btnCancel.fireEvent("click");
}
}
}
}
});
this.items = [{
xtype: "label",
text: this.labelSheetName,
width: "100%",
style: "text-align:left"
},
{
xtype: "tbspacer",
height: 4
},
this.txtName, {
xtype: "tbspacer",
height: 4
},
{
xtype: "container",
width: 240,
layout: "hbox",
layoutConfig: {
align: "stretch"
},
items: [{
xtype: "tbspacer",
flex: 1
},
_btnOk, {
xtype: "tbspacer",
width: 5
},
_btnCancel]
}];
this.callParent(arguments);
},
labelSheetName: "Sheet Name",
errTitle: "Error",
errNameExists: "Worksheet with such name already exist.",
errNameWrongChar: "A sheet name cannot contain characters: \\/*?[]:",
cancelButtonText: "Cancel"
});

View File

@@ -0,0 +1,888 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/StatusBar.template", "tip", "common/main/lib/component/TabBar", "common/main/lib/component/Menu", "common/main/lib/component/Window", "common/main/lib/component/ThemeColorPalette"], function (template) {
if (SSE.Views.Statusbar) {
var RenameDialog = SSE.Views.Statusbar.RenameDialog;
var CopyDialog = SSE.Views.Statusbar.CopyDialog;
}
SSE.Views.Statusbar = Common.UI.BaseView.extend(_.extend({
el: "#statusbar",
template: _.template(template),
events: function () {
return {
"click #status-btn-tabfirst": _.bind(this.onBtnTabScroll, this, "first"),
"click #status-btn-tabback": _.bind(this.onBtnTabScroll, this, "backward"),
"click #status-btn-tabnext": _.bind(this.onBtnTabScroll, this, "forward"),
"click #status-btn-tablast": _.bind(this.onBtnTabScroll, this, "last")
};
},
api: undefined,
initialize: function () {},
render: function () {
$(this.el).html(this.template());
var me = this;
this.editMode = false;
this.btnZoomDown = new Common.UI.Button({
el: $("#status-btn-zoomdown", this.el),
hint: this.tipZoomOut + " (Ctrl+-)",
hintAnchor: "top"
});
this.btnZoomUp = new Common.UI.Button({
el: $("#status-btn-zoomup", this.el),
hint: this.tipZoomIn + " (Ctrl++)",
hintAnchor: "top-right"
});
this.btnScrollFirst = new Common.UI.Button({
el: $("#status-btn-tabfirst", this.el),
hint: this.tipFirst,
disabled: true,
hintAnchor: "top"
});
this.btnScrollBack = new Common.UI.Button({
el: $("#status-btn-tabback", this.el),
hint: this.tipPrev,
disabled: true,
hintAnchor: "top"
});
this.btnScrollNext = new Common.UI.Button({
el: $("#status-btn-tabnext", this.el),
hint: this.tipNext,
disabled: true,
hintAnchor: "top"
});
this.btnScrollLast = new Common.UI.Button({
el: $("#status-btn-tablast", this.el),
hint: this.tipLast,
disabled: true,
hintAnchor: "top"
});
this.btnAddWorksheet = new Common.UI.Button({
el: $("#status-btn-addtab", this.el),
hint: this.tipAddTab,
disabled: true,
hintAnchor: "top"
});
this.cntZoom = new Common.UI.Button({
el: $(".cnt-zoom", this.el),
hint: this.tipZoomFactor,
hintAnchor: "top"
});
this.cntZoom.cmpEl.on({
"show.bs.dropdown": function () {
_.defer(function () {
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find("ul").focus();
},
100);
},
"hide.bs.dropdown": function () {
_.defer(function () {
me.api.asc_enableKeyEvents(true);
},
100);
}
});
this.zoomMenu = new Common.UI.Menu({
style: "margin-top:-5px;",
menuAlign: "bl-tl",
items: [{
caption: "50%",
value: 50
},
{
caption: "75%",
value: 75
},
{
caption: "100%",
value: 100
},
{
caption: "125%",
value: 125
},
{
caption: "150%",
value: 150
},
{
caption: "175%",
value: 175
},
{
caption: "200%",
value: 200
}]
});
this.zoomMenu.render($(".cnt-zoom", this.el));
this.zoomMenu.cmpEl.attr({
tabindex: -1
});
this.labelZoom = $("#status-label-zoom", this.$el);
this.panelUsers = $("#status-users-box", this.el);
this.panelUsers.find("#status-users-block").on("click", _.bind(this.onUsersClick, this));
this.tabBarBox = $("#status-sheets-bar-box", this.el);
this.tabbar = new Common.UI.TabBar({
el: "#status-sheets-bar",
placement: "bottom",
draggable: false
}).render();
this.tabbar.on({
"tab:invisible": _.bind(this.onTabInvisible, this),
"tab:changed": _.bind(this.onSheetChanged, this),
"tab:contextmenu": _.bind(this.onTabMenu, this),
"tab:dblclick": _.bind(function () {
if (me.editMode && (me.rangeSelectionMode !== c_oAscSelectionDialogType.Chart) && (me.rangeSelectionMode !== c_oAscSelectionDialogType.FormatTable)) {
me.fireEvent("sheet:changename");
}
},
this),
"tab:move": _.bind(function (tabIndex, index) {
me.tabBarScroll = {
scrollLeft: me.tabbar.scrollX
};
if (_.isUndefined(index) || tabIndex === index) {
return;
}
if (tabIndex < index) {
++index;
}
me.fireEvent("sheet:move", [false, true, tabIndex, index]);
},
this)
});
var menuHiddenItems = new Common.UI.Menu({
menuAlign: "tl-tr"
});
menuHiddenItems.on("item:click", function (obj, item, e) {
me.fireEvent("show:hidden", [me, item.value]);
});
var menuColorItems = new Common.UI.Menu({
menuAlign: "tl-tr",
cls: "color-tab",
items: [{
template: _.template('<div id="id-tab-menu-color" style="width: 165px; height: 220px; margin: 10px;"></div>')
},
{
template: _.template('<a id="id-tab-menu-new-color" style="padding-left:12px;">' + me.textNewColor + "</a>")
}]
});
function dummyCmp() {
return {
isDummy: true,
on: function () {}
};
}
me.mnuTabColor = dummyCmp();
this.tabMenu = new Common.UI.Menu({
menuAlign: "bl-tl",
items: [{
caption: this.itemInsert,
value: "ins"
},
{
caption: this.itemDelete,
value: "del"
},
{
caption: this.itemRename,
value: "ren"
},
{
caption: this.itemCopy,
value: "copy"
},
{
caption: this.itemMove,
value: "move"
},
{
caption: this.itemHide,
value: "hide"
},
{
caption: this.itemHidden,
menu: menuHiddenItems
},
{
caption: this.itemTabColor,
menu: menuColorItems
}]
}).on("render:after", function (btn) {
var colorVal = $('<div class="btn-color-value-line"></div>');
$("button:first-child", btn.cmpEl).append(colorVal);
colorVal.css("background-color", btn.currentColor || "transparent");
me.mnuTabColor = new Common.UI.ThemeColorPalette({
el: $("#id-tab-menu-color"),
dynamiccolors: 10,
colors: [me.textThemeColors, "-", {
color: "3366FF",
effectId: 1
},
{
color: "0000FF",
effectId: 2
},
{
color: "000090",
effectId: 3
},
{
color: "660066",
effectId: 4
},
{
color: "800000",
effectId: 5
},
{
color: "FF0000",
effectId: 1
},
{
color: "FF6600",
effectId: 1
},
{
color: "FFFF00",
effectId: 2
},
{
color: "CCFFCC",
effectId: 3
},
{
color: "008000",
effectId: 4
},
"-", {
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 3
},
{
color: "FFFFFF",
effectId: 4
},
{
color: "000000",
effectId: 5
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
{
color: "FFFFFF",
effectId: 2
},
{
color: "000000",
effectId: 1
},
"-", "--", "-", me.textStandartColors, "-", "transparent", "5301B3", "980ABD", "B2275F", "F83D26", "F86A1D", "F7AC16", "F7CA12", "FAFF44", "D6EF39", "-", "--"]
});
me.mnuTabColor.on("select", function (picker, color) {
me.fireEvent("sheet:setcolor", [color]);
});
});
this.tabbar.$el.append('<div class="menu-backdrop" data-toggle="dropdown" style="width:0; height:0;"/>');
this.tabMenu.render(this.tabbar.$el);
this.tabMenu.on("show:after", _.bind(this.onTabMenuAfterShow, this));
this.tabMenu.on("hide:after", _.bind(this.onTabMenuAfterHide, this));
this.tabMenu.on("item:click", _.bind(this.onTabMenuClick, this));
this.boxMath = $("#status-math-box", this.el);
this.labelSum = $("#status-math-sum", this.boxMath);
this.labelCount = $("#status-math-count", this.boxMath);
this.labelAverage = $("#status-math-average", this.boxMath);
this.boxMath.hide();
this.boxZoom = $("#status-zoom-box", this.el);
this.boxZoom.find(".separator").css("border-left-color", "transparent");
return this;
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onSheetsChanged", _.bind(this.update, this));
return this;
},
setMode: function (mode) {
this.mode = _.extend({},
this.mode, mode);
this.btnAddWorksheet.setVisible(this.mode.isEdit);
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected);
},
setVisible: function (visible) {
visible ? this.show() : this.hide();
},
update: function () {
var me = this;
this.fireEvent("updatesheetsinfo", this);
this.tabbar.empty(true);
this.tabMenu.items[6].menu.removeAll();
this.tabMenu.items[6].hide();
this.btnAddWorksheet.setDisabled(true);
if (this.api) {
var wc = this.api.asc_getWorksheetsCount(),
i = -1;
var hidentems = [],
items = [],
tab,
locked;
var sindex = this.api.asc_getActiveWorksheetIndex();
while (++i < wc) {
locked = me.api.asc_isWorksheetLockedOrDeleted(i);
tab = {
sheetindex: i,
active: sindex == i,
label: me.api.asc_getWorksheetName(i),
cls: locked ? "coauth-locked" : "",
isLockTheDrag: locked
};
this.api.asc_isWorksheetHidden(i) ? hidentems.push(tab) : items.push(tab);
}
if (hidentems.length) {
hidentems.forEach(function (item) {
me.tabMenu.items[6].menu.addItem(new Common.UI.MenuItem({
style: "white-space: pre-wrap",
caption: Common.Utils.String.htmlEncode(item.label),
value: item.sheetindex
}));
});
this.tabMenu.items[6].show();
}
this.tabbar.add(items);
if (!_.isUndefined(this.tabBarScroll)) {
this.tabbar.$bar.scrollLeft(this.tabBarScroll.scrollLeft);
this.tabBarScroll = undefined;
} else {
this.tabbar.setTabVisible("last");
}
this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked());
$("#status-label-zoom").text(Common.Utils.String.format(this.zoomText, Math.floor((this.api.asc_getZoom() + 0.005) * 100)));
me.fireEvent("sheet:updateColors", [true]);
}
},
setMathInfo: function (info) {
if (info.count > 1) {
if (!this.boxMath.is(":visible")) {
this.boxMath.show();
}
this.labelCount.text(this.textCount + ": " + info.count);
this.labelSum.text((info.sum && info.sum.length) ? (this.textSum + ": " + info.sum) : "");
this.labelAverage.text((info.average && info.average.length) ? (this.textAverage + ": " + info.average) : "");
} else {
if (this.boxMath.is(":visible")) {
this.boxMath.hide();
}
}
var me = this;
_.delay(function () {
me.onTabInvisible(undefined, me.tabbar.checkInvisible(true));
},
30);
},
onUsersClick: function () {
this.fireEvent("click:users", this);
},
onSheetChanged: function (o, index, tab) {
this.api.asc_showWorksheet(tab.sheetindex);
if (this.hasTabInvisible && !this.tabbar.isTabVisible(index)) {
this.tabbar.setTabVisible(index);
}
this.fireEvent("sheet:changed", [this, tab.sheetindex]);
this.fireEvent("sheet:updateColors", [true]);
Common.NotificationCenter.trigger("comments:updatefilter", {
property: "uid",
value: new RegExp("^(doc_|sheet" + this.api.asc_getActiveWorksheetId() + "_)")
},
false);
},
onTabMenu: function (o, index, tab) {
if (this.mode.isEdit && (this.rangeSelectionMode !== c_oAscSelectionDialogType.Chart) && (this.rangeSelectionMode !== c_oAscSelectionDialogType.FormatTable)) {
if (tab && tab.sheetindex >= 0) {
var rect = tab.$el.get(0).getBoundingClientRect(),
childPos = tab.$el.offset(),
parentPos = tab.$el.parent().offset();
if (!tab.isActive()) {
this.tabbar.setActive(tab);
}
var issheetlocked = this.api.asc_isWorksheetLockedOrDeleted(tab.sheetindex),
isdoclocked = this.api.asc_isWorkbookLocked();
this.tabMenu.items[0].setDisabled(isdoclocked);
this.tabMenu.items[1].setDisabled(issheetlocked);
this.tabMenu.items[2].setDisabled(issheetlocked);
this.tabMenu.items[3].setDisabled(issheetlocked);
this.tabMenu.items[4].setDisabled(issheetlocked);
this.tabMenu.items[5].setDisabled(issheetlocked);
this.tabMenu.items[6].setDisabled(isdoclocked);
this.tabMenu.items[7].setDisabled(issheetlocked);
this.api.asc_closeCellEditor();
this.api.asc_enableKeyEvents(false);
this.tabMenu.atposition = (function () {
return {
top: rect.top,
left: rect.left - parentPos.left - 2
};
})();
this.tabMenu.hide();
this.tabMenu.show();
}
}
},
onTabMenuAfterShow: function (obj) {
if (obj.atposition) {
obj.setOffset(obj.atposition.left);
}
this.enableKeyEvents = true;
},
onTabMenuAfterHide: function () {
if (!_.isUndefined(this.enableKeyEvents)) {
if (this.api) {
this.api.asc_enableKeyEvents(this.enableKeyEvents);
}
this.enableKeyEvents = undefined;
}
},
onTabMenuClick: function (o, item) {
if (item && this.api) {
this.enableKeyEvents = (item.value === "ins" || item.value === "hide");
}
},
onTabInvisible: function (obj, opts) {
if (this.btnScrollFirst.isDisabled() !== (!opts.first)) {
this.btnScrollFirst.setDisabled(!opts.first);
this.btnScrollBack.setDisabled(!opts.first);
}
if (this.btnScrollNext.isDisabled() !== (!opts.last)) {
this.btnScrollNext.setDisabled(!opts.last);
this.btnScrollLast.setDisabled(!opts.last);
}
this.hasTabInvisible = opts.first || opts.last;
},
onBtnTabScroll: function (action, e) {
this.tabbar.setTabVisible(action);
},
updateTabbarBorders: function () {
var right = parseInt(this.boxZoom.css("width")),
visible = false;
if (this.boxMath.is(":visible")) {
right += parseInt(this.boxMath.css("width"));
visible = true;
}
if (this.panelUsers.is(":visible")) {
right += parseInt(this.panelUsers.css("width"));
visible = true;
}
this.boxZoom.find(".separator").css("border-left-color", visible ? "" : "transparent");
this.tabBarBox.css("right", right + "px");
},
changeViewMode: function (edit) {
if (edit) {
this.tabBarBox.css("left", "152px");
} else {
this.tabBarBox.css("left", "");
}
this.tabbar.options.draggable = edit;
this.editMode = edit;
},
tipZoomIn: "Zoom In",
tipZoomOut: "Zoom Out",
tipZoomFactor: "Magnification",
tipFirst: "First Sheet",
tipLast: "Last Sheet",
tipPrev: "Previous Sheet",
tipNext: "Next Sheet",
tipAddTab: "Add Worksheet",
itemInsert: "Insert",
itemDelete: "Delete",
itemRename: "Rename",
itemCopy: "Copy",
itemMove: "Move",
itemHide: "Hide",
itemHidden: "Hidden",
itemTabColor: "Tab Color",
textThemeColors: "Theme Colors",
textStandartColors: "Standart Colors",
textNoColor: "No Color",
textNewColor: "Add New Custom Color",
zoomText: "Zoom {0}%",
textSum: "SUM",
textCount: "COUNT",
textAverage: "AVERAGE"
},
SSE.Views.Statusbar || {}));
SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({
options: {
header: false,
width: 280,
cls: "modal-dlg"
},
template: '<div class="box">' + '<div class="input-row">' + "<label><%= label %></label>" + "</div>" + '<div class="input-row" id="txt-sheet-name" />' + "</div>" + '<div class="footer right">' + '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button>' + '<button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button>' + "</div>",
initialize: function (options) {
_.extend(this.options, options || {},
{
label: this.labelSheetName,
btns: {
ok: this.okButtonText,
cancel: this.cancelButtonText
}
});
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild();
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
this.txtName = new Common.UI.InputField({
el: $window.find("#txt-sheet-name"),
style: "width:100%;",
value: this.options.current,
allowBlank: false,
validation: _.bind(this.nameValidator, this)
});
if (this.txtName) {
this.txtName.$el.find("input").attr("maxlength", 31);
this.txtName.$el.on("keypress", "input[type=text]", _.bind(this.onNameKeyPress, this));
}
},
show: function (x, y) {
Common.UI.Window.prototype.show.apply(this, arguments);
var edit = this.txtName.$el.find("input");
_.delay(function (me) {
edit.focus();
edit.select();
},
100, this);
},
onBtnClick: function (event) {
this.doClose(event.currentTarget.attributes["result"].value);
},
doClose: function (res) {
if (res == "ok") {
if (this.txtName.checkValidate() !== true) {
_.delay(function (me) {
me.txtName.focus();
},
100, this);
return;
}
}
if (this.options.handler) {
this.options.handler.call(this, res, this.txtName.getValue());
}
this.close();
},
onNameKeyPress: function (e) {
if (e.keyCode == Common.UI.Keys.RETURN) {
this.doClose("ok");
}
},
nameValidator: function (value) {
if (this.options.names) {
var testval = value.toLowerCase();
for (var i = this.options.names.length - 1; i >= 0; --i) {
if (this.options.names[i] === testval) {
return this.errNameExists;
}
}
}
if (value.length > 2 && value[0] == '"' && value[value.length - 1] == '"') {
return true;
}
if (!/[:\\\/\*\?\[\]\']/.test(value)) {
return true;
}
return this.errNameWrongChar;
},
errNameExists: "Worksheet with such name already exist.",
errNameWrongChar: "A sheet name cannot contains characters: \\, /, *, ?, [, ], :",
labelSheetName: "Sheet Name"
},
RenameDialog || {}));
SSE.Views.Statusbar.CopyDialog = Common.UI.Window.extend(_.extend({
options: {
width: 270,
height: 300,
cls: "modal-dlg"
},
template: '<div class="box">' + '<div class="input-row">' + "<label><%= label %></label>" + "</div>" + '<div id="status-list-names" style="height: 170px;"/>' + "</div>" + '<div class="footer center">' + '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button>' + '<button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button>' + "</div>",
initialize: function (options) {
_.extend(this.options, options || {},
{
label: options.ismove ? this.textMoveBefore : this.textCopyBefore,
btns: {
ok: this.okButtonText,
cancel: this.cancelButtonText
}
});
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild();
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
var pages = [];
this.options.names.forEach(function (item) {
pages.push(new Common.UI.DataViewModel(item));
},
this);
if (pages.length) {
pages.push(new Common.UI.DataViewModel({
value: this.options.ismove ? this.itemMoveToEnd : this.itemCopyToEnd,
inindex: -255
}));
}
this.listNames = new Common.UI.ListView({
el: $("#status-list-names", $window),
store: new Common.UI.DataViewStore(pages),
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= Common.Utils.String.htmlEncode(value) %></div>')
});
this.listNames.selectByIndex(0);
this.listNames.on("entervalue", _.bind(this.onPrimary, this));
this.listNames.on("item:dblclick", _.bind(this.onPrimary, this));
this.mask = $(".modals-mask");
this.mask.on("mousedown", _.bind(this.onUpdateFocus, this));
},
show: function (x, y) {
Common.UI.Window.prototype.show.apply(this, arguments);
_.delay(function (me) {
me.listNames.$el.find(".listview").focus();
},
100, this);
},
hide: function () {
Common.UI.Window.prototype.hide.apply(this, arguments);
this.mask.off("mousedown", _.bind(this.onUpdateFocus, this));
},
onBtnClick: function (event) {
var active = this.listNames.getSelectedRec();
if (this.options.handler) {
this.options.handler.call(this, event.currentTarget.attributes["result"].value, active[0].get("inindex"));
}
this.close();
},
onPrimary: function () {
if (this.options.handler) {
this.options.handler.call(this, "ok", this.listNames.getSelectedRec()[0].get("inindex"));
}
this.close();
},
onUpdateFocus: function () {
_.delay(function (me) {
me.listNames.$el.find(".listview").focus();
},
100, this);
},
itemCopyToEnd: "(Copy to end)",
itemMoveToEnd: "(Move to end)",
textCopyBefore: "Copy before sheet",
textMoveBefore: "Move before sheet"
},
CopyDialog || {}));
});

View File

@@ -1,149 +1,150 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.view.TableOptionsDialog", {
extend: "Ext.window.Window",
alias: "widget.tableoptionsdialog",
requires: ["Ext.window.Window"],
closable: true,
resizable: false,
height: 145,
width: 300,
padding: "12px 20px 0 20px",
constrain: true,
layout: {
type: "vbox",
align: "stretch"
},
listeners: {
show: function () {
var options = this.api.asc_getAddFormatTableOptions();
this.txtDataRange.setValue(options.asc_getRange());
this.chTitle.setValue(options.asc_getIsTitle());
this.api.asc_setSelectionDialogMode(true, options.asc_getRange());
},
beforedestroy: function () {
this.api.asc_setSelectionDialogMode(false);
}
},
initComponent: function () {
var me = this;
var worksheets = "",
names = this.names;
if (names) {
worksheets = names[0];
var i = names.length;
while (--i) {
worksheets += ("|" + names[i]);
}
}
var longRe = new RegExp(worksheets + "![A-Z]+[1-9]\d*:[A-Z]+[1-9]\d*");
var shortRe = new RegExp(worksheets + "![A-Z]+[1-9]\d*");
this.txtDataRange = Ext.create("Ext.form.Text", {
height: 22,
msgTarget: "side",
validateOnBlur: false,
allowBlank: false,
value: "",
editable: false,
check: false,
validator: function (value) {
if (!this.check) {
return true;
}
var isvalid = longRe.test(value); ! isvalid && (isvalid = shortRe.test(value));
if (isvalid) {
$("#" + this.id + " input").css("color", "black");
return true;
} else {
$("#" + this.id + " input").css("color", "red");
return "ERROR! Invalid cells range";
}
}
});
this.chTitle = Ext.widget("checkbox", {
style: "margin: 0 26px 0 0",
boxLabel: this.txtTitle
});
var _btnOk = Ext.create("Ext.Button", {
text: Ext.Msg.buttonText.ok,
width: 80,
style: "margin: 0 6px 0 0;",
cls: "asc-blue-button",
listeners: {
click: function () {
if (me.txtDataRange.validate()) {
me.fireEvent("onmodalresult", me, 1, me.getSettings());
me.close();
}
}
}
});
var _btnCancel = Ext.create("Ext.Button", {
text: this.textCancel,
width: 80,
cls: "asc-darkgray-button",
listeners: {
click: function () {
me.close();
}
}
});
this.items = [this.txtDataRange, this.chTitle, {
xtype: "container",
height: 26,
style: "margin: 8px 0 0 0;",
layout: {
type: "hbox",
align: "stretch",
pack: "end"
},
items: [_btnOk, _btnCancel]
}];
if (this.api) {
this.api.asc_registerCallback("asc_onSelectionRangeChanged", Ext.bind(this._onRangeChanged, this));
}
this.callParent(arguments);
this.setTitle(this.txtFormat);
},
_onRangeChanged: function (info) {
this.txtDataRange.setValue(info);
},
getSettings: function () {
var options = this.api.asc_getAddFormatTableOptions();
options.asc_setRange(this.txtDataRange.getValue());
options.asc_setIsTitle(this.chTitle.getValue());
return options;
},
txtTitle: "Title",
txtFormat: "Format as table",
textCancel: "Cancel"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
define(["common/main/lib/component/ComboBox", "common/main/lib/component/CheckBox", "common/main/lib/component/InputField", "common/main/lib/component/Window"], function () {
SSE.Views.TableOptionsDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
cls: "modal-dlg",
modal: false
},
initialize: function (options) {
_.extend(this.options, {
title: this.txtFormat
},
options);
this.template = ['<div class="box">', '<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 10px;"></div>', '<div class="input-row" id="id-dlg-tableoptions-title"></div>', "</div>", '<div class="footer right">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + "</button>", '<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + "</button>", "</div>"].join("");
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild(),
me = this;
me.inputRange = new Common.UI.InputField({
el: $("#id-dlg-tableoptions-range"),
name: "range",
style: "width: 100%;",
allowBlank: false,
blankError: this.txtEmpty,
validateOnChange: true
});
me.cbTitle = new Common.UI.CheckBox({
el: $("#id-dlg-tableoptions-title"),
labelText: this.txtTitle
});
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
me.inputRange.cmpEl.find("input").on("keypress", _.bind(this.onKeyPress, this));
this.on("close", _.bind(this.onClose, this));
},
onPrimary: function () {
this._handleInput("ok");
return false;
},
setSettings: function (settings) {
var me = this;
if (settings.api) {
me.api = settings.api;
var options = me.api.asc_getAddFormatTableOptions();
this.inputRange.setValue(options.asc_getRange());
this.cbTitle.setValue(options.asc_getIsTitle());
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.FormatTable, options.asc_getRange());
me.api.asc_registerCallback("asc_onSelectionRangeChanged", _.bind(me.onApiRangeChanged, me));
Common.NotificationCenter.trigger("cells:range", c_oAscSelectionDialogType.FormatTable);
}
me.inputRange.validation = function (value) {
var isvalid = me.api.asc_checkDataRange(c_oAscSelectionDialogType.FormatTable, value, false);
return (isvalid == c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
};
},
getSettings: function () {
var options = this.api.asc_getAddFormatTableOptions();
options.asc_setRange(this.inputRange.getValue());
options.asc_setIsTitle(this.cbTitle.checked);
return options;
},
onApiRangeChanged: function (info) {
this.inputRange.setValue(info);
if (this.inputRange.cmpEl.hasClass("error")) {
this.inputRange.cmpEl.removeClass("error");
}
},
isRangeValid: function () {
var isvalid = this.api.asc_checkDataRange(c_oAscSelectionDialogType.FormatTable, this.inputRange.getValue(), true);
if (isvalid == c_oAscError.ID.No) {
return true;
} else {
if (isvalid == c_oAscError.ID.AutoFilterDataRangeError) {
Common.UI.warning({
msg: this.errorAutoFilterDataRange
});
}
}
return false;
},
onBtnClick: function (event) {
this._handleInput(event.currentTarget.attributes["result"].value);
},
onClose: function (event) {
if (this.api) {
this.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.None);
}
Common.NotificationCenter.trigger("cells:range", c_oAscSelectionDialogType.None);
Common.NotificationCenter.trigger("edit:complete", this);
},
onKeyPress: function (event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput("ok");
}
},
_handleInput: function (state) {
if (this.options.handler) {
if (state == "ok") {
if (this.isRangeValid() !== true) {
return;
}
}
this.options.handler.call(this, this, state);
}
this.close();
},
txtTitle: "Title",
txtFormat: "Format as table",
textCancel: "Cancel",
txtEmpty: "This field is required",
txtInvalidRange: "ERROR! Invalid cells range",
errorAutoFilterDataRange: "The operation could not be done for the selected range of cells.<br>Select a uniform data range inside or outside the table and try again."
},
SSE.Views.TableOptionsDialog || {}));
});

File diff suppressed because one or more lines are too long

View File

@@ -1,312 +1,133 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
window.cancelButtonText = "Cancel";
Ext.define("SSE.view.Viewport", {
extend: "Ext.container.Viewport",
alias: "widget.sseviewport",
layout: "fit",
uses: ["SSE.view.DocumentHolder", "SSE.view.MainMenu", "SSE.view.File", "SSE.view.DocumentStatusInfo", "SSE.view.CellInfo", "Common.view.ChatPanel", "Common.view.CommentsPanel", "Common.view.Header", "SSE.view.Toolbar", "Common.view.SearchDialog", "Common.view.About", "SSE.view.RightMenu"],
initComponent: function () {
this.header = Ext.widget("commonheader", {
config: {
headerCaption: "Spreadsheet Editor"
}
});
this.applicationUI = Ext.widget("container", {
layout: {
type: "vbox",
align: "stretch"
},
flex: 1,
hidden: true,
items: [{
xtype: "container",
flex: 1,
layout: {
type: "hbox",
align: "stretch"
},
items: [{
xtype: "ssemainmenu",
id: "view-main-menu",
maxWidth: 600,
listeners: {
panelshow: function (panel, fulscreen) {
if (fulscreen) {
var menu = Ext.getCmp("view-main-menu");
menu.clearSelection({
id: menu.currentFullScaleMenuBtn.id
});
}
}
},
buttonCollection: [{
cls: "menuFile",
tooltip: this.tipFile + " (Alt+F)",
id: "id-menu-file",
scale: "full",
disabled: true,
items: [{
xtype: "ssefile",
id: "main-menu-file-options",
width: "100%",
height: "100%"
}]
},
{
cls: "menuSearch",
scale: "modal",
id: "main-menu-search",
disabled: true,
tooltip: this.tipSearch + " (Ctrl+F)"
},
{
cls: "menuComments",
id: "id-menu-comments",
hideMode: "display",
scale: 300,
tooltip: this.tipComments + " (Ctrl+Shift+H)",
disabled: true,
items: [{
xtype: "commoncommentspanel",
height: "100%"
}]
},
{
cls: "menuChat",
id: "id-menu-chat",
scale: 300,
tooltip: this.tipChat + " (Ctrl+Alt+Q)",
disabled: true,
items: [{
xtype: "commonchatpanel",
height: "100%"
}]
},
{
cls: "menuAbout",
id: "id-menu-about",
tooltip: "About",
scale: "full",
disabled: true,
items: [{
xtype: "commonabout",
id: "main-menu-about",
width: "100%",
height: "100%"
}]
}]
},
{
xtype: "splitter",
id: "main-menu-splitter",
cls: "splitter-document-area",
defaultSplitMin: 300,
hidden: true
},
{
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
maintainFlex: true,
flex: 1,
items: [{
xtype: "ssecellinfo",
id: "cell-edit",
style: "border-left:solid 1px #afafaf;"
},
{
xtype: "splitter",
id: "field-formula-splitter",
defaultSplitMin: 23,
cls: "splitter-document-area"
},
{
id: "editor_sdk",
minHeight: 70,
xtype: "ssedocumentholder",
maintainFlex: true,
flex: 1
}]
}]
},
{
xtype: "documentstatusinfo",
id: "view-status"
}]
});
this.items = {
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
items: [this.header, this.applicationUI]
};
Ext.tip.QuickTipManager.init();
this.callParent(arguments);
},
applyMode: function () {
this.hkSaveAs[this.mode.canDownload ? "enable" : "disable"]();
this.hkChat[this.mode.canCoAuthoring ? "enable" : "disable"]();
this.hkComments[(this.mode.canCoAuthoring && this.mode.isEdit) ? "enable" : "disable"]();
},
setMode: function (m, delay) {
m.isDisconnected ? this.mode.canDownload = this.mode.canCoAuthoring = false : this.mode = m;
if (!delay) {
this.applyMode();
}
},
applyEditorMode: function () {
var me = this;
me._toolbar = Ext.widget("ssetoolbar", {
id: "view-toolbar"
});
me._rightMenu = Ext.widget("sserightmenu", {
id: "view-right-menu"
});
me.applicationUI.insert(0, me._toolbar);
me.applicationUI.items.items[1].add(me._rightMenu);
me._toolbar.setVisible(true);
},
createDelayedElements: function () {
var _self = this;
this.hotKeys = new Ext.util.KeyMap(document, [{
key: "f",
ctrl: true,
shift: false,
defaultEventAction: "stopEvent",
fn: function () {
if (canHotKey()) {
var cmp = Ext.getCmp("view-main-menu");
if (cmp) {
cmp.selectMenu("menuSearch");
}
}
}
},
{
key: [Ext.EventObject.PAGE_DOWN, Ext.EventObject.PAGE_UP],
ctrl: false,
shift: false,
alt: true,
defaultEventAction: "stopEvent",
fn: function (key, event) {
if (canHotKey()) {
var cmp = Ext.getCmp("view-status");
if (cmp) {
cmp.setActiveWorksheet(undefined, key == event.PAGE_DOWN ? ACTIVE_TAB_NEXT : ACTIVE_TAB_PREV);
}
}
}
},
{
key: "f",
alt: true,
defaultEventAction: "stopEvent",
fn: function () {
if (canHotKey()) {
Ext.menu.Manager.hideAll();
var cmp = Ext.getCmp("view-main-menu");
if (cmp) {
cmp.selectMenu("menuFile");
}
}
}
}]);
this.hkSaveAs = new Ext.util.KeyMap(document, {
key: "s",
ctrl: true,
shift: true,
defaultEventAction: "stopEvent",
fn: function () {
if (canHotKey()) {
Ext.menu.Manager.hideAll();
var cmp = Ext.getCmp("view-main-menu");
if (cmp) {
cmp.selectMenu("menuFile");
}
}
}
});
this.hkHelp = new Ext.util.KeyMap(document, {
key: Ext.EventObject.F1,
ctrl: false,
shift: false,
defaultEventAction: "stopEvent",
scope: this,
fn: function () {
if (canHotKey()) {
Ext.menu.Manager.hideAll();
var cmp = Ext.getCmp("view-main-menu");
if (cmp) {
cmp.selectMenu("menuFile");
}
}
}
});
this.hkChat = new Ext.util.KeyMap(document, {
key: "q",
ctrl: true,
alt: true,
defaultEventAction: "stopEvent",
fn: function () {
if (canHotKey()) {
var cmp = Ext.getCmp("view-main-menu");
if (cmp) {
cmp.selectMenu("menuChat");
}
}
}
});
this.hkComments = new Ext.util.KeyMap(document, {
key: "H",
ctrl: true,
shift: true,
defaultEventAction: "stopEvent",
fn: function () {
if (canHotKey()) {
var cmp = Ext.getCmp("view-main-menu");
if (cmp) {
cmp.selectMenu("menuComments");
}
}
}
});
},
tipChat: "Chat",
tipComments: "Comments",
tipFile: "File",
tipSearch: "Search"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!spreadsheeteditor/main/app/template/Viewport.template", "jquery", "underscore", "backbone", "common/main/lib/component/BaseView", "common/main/lib/component/Layout"], function (viewportTemplate, $, _, Backbone) {
SSE.Views.Viewport = Backbone.View.extend({
el: "#viewport",
template: _.template(viewportTemplate),
events: {},
initialize: function () {},
render: function () {
var el = $(this.el);
el.html(this.template({}));
if (Common.Utils.isSafari) {
$("body").addClass("safari");
$("body").mousewheel(function (e) {
e.preventDefault();
e.stopPropagation();
});
} else {
if (Common.Utils.isChrome) {
$("body").addClass("chrome");
}
}
var $container = $("#viewport-vbox-layout", el);
var items = $container.find(" > .layout-item");
this.vlayout = new Common.UI.VBoxLayout({
box: $container,
items: [{
el: items[0],
rely: true
},
{
el: items[1],
rely: true
},
{
el: items[2],
stretch: true
},
{
el: items[3],
height: 25
}]
});
$container = $("#viewport-hbox-layout", el);
items = $container.find(" > .layout-item");
this.hlayout = new Common.UI.HBoxLayout({
box: $container,
items: [{
el: items[0],
rely: true,
resize: {
hidden: true,
autohide: false,
min: 300,
max: 600
}
},
{
el: items[1],
stretch: true
},
{
el: $(items[2]).hide(),
rely: true
}]
});
$container = $container.find(".layout-ct.vbox");
items = $container.find(" > .layout-item");
this.celayout = new Common.UI.VBoxLayout({
box: $container,
items: [{
el: items[0],
rely: true,
resize: {
min: 19,
max: -100
}
},
{
el: items[1],
stretch: true
}]
});
return this;
},
applyEditorMode: function () {
var me = this,
toolbarView = SSE.getController("Toolbar").getView("Toolbar"),
rightMenuView = SSE.getController("RightMenu").getView("RightMenu");
me._toolbar = toolbarView.render(this.mode.isEditDiagram);
me._rightMenu = rightMenuView.render();
},
setMode: function (mode, delay) {
if (mode.isDisconnected) {
if (_.isUndefined(this.mode)) {
this.mode = {};
}
this.mode.canCoAuthoring = false;
} else {
this.mode = mode;
}
}
});
});

View File

@@ -1,34 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var getEditorStylesheets = function () {
return ["../../common/main/resources/css/hsb-colorpicker.css", "../../common/main/resources/css/themecolorpalette.css", "../../common/main/resources/css/grouped-data-view.css", "../../common/main/resources/css/dataview-combo.css", "resources/css/toolbar.css", "resources/css/advanced-settings-dialog.css", "../../common/main/resources/css/dataview-picker.css", "../../common/main/resources/css/multislider-gradient.css", "resources/css/right-panels.css"];
};

View File

@@ -1,7 +0,0 @@
var getEditorStylesheets = function() {
return ["../../../apps/spreadsheeteditor/main/resources/css/app-edit.css"];
};
var getEditorScripts = function() {
return ["../../../apps/spreadsheeteditor/main/app-edit.js"];
};

View File

@@ -1,227 +1,177 @@
<!DOCTYPE html>
<html>
<head>
<title>ONLYOFFICE Document Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="icon" href="resources/img/favicon.png" type="image/png" />
<link rel="stylesheet" type="text/css" href="../../../3rdparty/extjs/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/asc.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/header.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/searchfield.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/searchdialog.css">
<link rel="stylesheet" type="text/css" href="resources/css/ss-main-colors.css">
<link rel="stylesheet" type="text/css" href="resources/css/header.css">
<link rel="stylesheet" type="text/css" href="resources/css/document-holder.css">
<link rel="stylesheet" type="text/css" href="resources/css/document-statusinfo.css">
<link rel="stylesheet" type="text/css" href="resources/css/main-menu.css">
<link rel="stylesheet" type="text/css" href="resources/css/file.css">
<link rel="stylesheet" type="text/css" href="resources/css/file-create-new.css">
<link rel="stylesheet" type="text/css" href="resources/css/file-open-recent.css">
<link rel="stylesheet" type="text/css" href="resources/css/tab-bar.css">
<link rel="stylesheet" type="text/css" href="resources/css/general.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/jquery.jscrollpane.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/load-mask.css">
<link rel="stylesheet" type="text/css" href="../../common/main/resources/css/chat-panel.css">
<link rel="stylesheet" type="text/css" href="../../../sdk/Excel/css/main.css"/>
<!-- splash -->
<style type="text/css">
.loadmask {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 20002;
}
.loadmask-body {
font-weight: bold;
font-family: Arial;
position:relative;
top:44%;
}
.loadmask-logo {
display:inline-block;
min-width: 220px;
height: 62px;
vertical-align:top;
background-image:url('./resources/img/loading-logo.gif');
background-image: -webkit-image-set(url('./resources/img/loading-logo.gif') 1x, url('./resources/img/loading-logo@2x.gif') 2x);
background-repeat:no-repeat;
}
#loadmask-text {
color: #b2b2b2;
font-size: 10px;
height:14px;
margin-top:32px;
padding-left:44px;
text-align:left;
text-transform: uppercase;
}
#loadmask-tmlink {
border-top: 1px solid #d3d3d3;
margin-top: 15px;
padding-top: 11px;
width: 270px;
margin-left: -14px;
font-size: 18px;
color: #6e6e6e;
}
</style>
</head>
<body>
<div id="loading-mask" class="loadmask">
<div class="loadmask-body" align="center">
<div class="loadmask-logo">
<!-- <div id="loadmask-text">LOADING APPLICATION</div> -->
<!--<div id="loadmask-tmlink">www.onlyoffice.com</div>-->
</div>
</div>
</div>
<!-- 3rdparty -->
<script type="text/javascript" src="../../../3rdparty/extjs/ext-debug.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/mousewheel/jquery.mousewheel.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/jscrollpane/jquery.jscrollpane.js"></script>
<script type="text/javascript" src="../../../3rdparty/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../../../3rdparty/sockjs/sockjs-0.3.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/underscore/underscore-min.js"></script>
<!-- application -->
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="../../common/Gateway.js"></script>
<script type="text/javascript" src="../../common/IrregularStack.js"></script>
<script type="text/javascript" src="../../common/main/loader.js"></script>
<script type="text/javascript" src="../../common/main/lib/component/util/MetricSettings.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="restrictions.js"></script>
<script type="text/javascript" src="environment.js"></script>
<script type="text/javascript" src="../../common/locale.js"></script>
<!-- sdk -->
<script type="text/javascript" src="../../../sdk/Common/docscoapisettings.js"></script>
<script type="text/javascript" src="../../../sdk/Common/AllFonts.js"></script>
<script type="text/javascript" src="../../../sdk/Common/browser.js"></script>
<script type="text/javascript" src="../../../sdk/Common/docscoapisettings.js"></script>
<script type="text/javascript" src="../../../sdk/Common/docscoapicommon.js"></script>
<script type="text/javascript" src="../../../sdk/Common/docscoapi.js"></script>
<script type="text/javascript" src="../../../sdk/Common/downloaderfiles.js"></script>
<script type="text/javascript" src="../../../sdk/Common/apiCommon.js"></script>
<script type="text/javascript" src="../../../sdk/Common/commonDefines.js"></script>
<script type="text/javascript" src="../../../sdk/Common/editorscommon.js"></script>
<script type="text/javascript" src="../../../sdk/Common/NumFormat.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Charts/charts.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Charts/DrawingObjects.js"></script>
<script type="text/javascript" src="../../../sdk/Common/FontsFreeType/font_engine.js"></script>
<script type="text/javascript" src="../../../sdk/Common/FontsFreeType/FontFile.js"></script>
<script type="text/javascript" src="../../../sdk/Common/FontsFreeType/FontManager.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/HatchPattern.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/Externals.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/Graphics.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/Metafile.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/GlobalLoaders.js"></script>
<script type="text/javascript" src="../../../sdk/Common/trackFile.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/apiDefines.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/offlinedocs/test-workbook9/Editor.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/offlinedocs/empty-workbook.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/utils/utils.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/clipboard.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/autofilters.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/graphics/DrawingContext.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/graphics/pdfprinter.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/CollaborativeEditing.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/ConditionalFormatting.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/parserFormula.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/dateandtimeFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/engineeringFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/cubeFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/databaseFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/textanddataFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/statisticalFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/financialFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/mathematicFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/lookupandreferenceFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/informationFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/FormulaObjects/logicalFunctions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/Serialize.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/WorkbookElems.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/Workbook.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/CellInfo.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/AdvancedOptions.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/History.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/UndoRedo.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/CellComment.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/StringRender.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/CellTextRender.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/CellEditorView.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/WorksheetView.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/HandlerList.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/EventsController.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/view/WorkbookView.js"></script>
<script type="text/javascript" src="../../../sdk/Common/scroll.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/ColorArray.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Shapes/EditorSettings.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Shapes/Serialize.js"></script>
<script type="text/javascript" src="../../../sdk/Common/Shapes/SerializeWriter.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Editor/SerializeCommon.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Format.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Editor/GraphicObjects/ObjectTypes/CreateGeometry.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Geometry.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Path.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Editor/GraphicObjects/Math.js"></script>
<script type="text/javascript" src="../../../sdk/Word/Drawing/ArcTo.js"></script>
<script type="text/javascript" src="../../../sdk/Common/SerializeCommonWordExcel.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/DrawingObjectsController.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/States.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/GroupShape.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Image.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Shape.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/TextBody.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Styles.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Numbering.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ParagraphContent.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Paragraph.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/DocumentContent.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/FontClassification.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/Chart.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ChartLayout.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ChartLegend.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Format/ChartTitle.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/AdjustmentTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/ResizeTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/RotateTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/NewShapeTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/PolyLine.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/Spline.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Tracks/MoveTracks.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Hit.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Controls.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Graphics.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/Overlay.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/GlobalCounters.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/DrawingDocument.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/model/DrawingObjects/ShapeDrawer.js"></script>
<script type="text/javascript" src="../../../sdk/Word/apiCommon.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/api.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>ONLYOFFICE Document Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="../../../sdk/Excel/css/main.css"/>
<!-- debug begin -->
<link rel="stylesheet/less" type="text/css" href="resources/less/app.less" />
<!-- debug end -->
<!-- splash -->
<style type="text/css">
.loadmask {
left: 0;
top: 0;
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 100;
}
.loader-page {
top: 50%;
left: 50%;
width: 50px;
height: 180px;
z-index: 100;
position: absolute;
margin-top: -100px;
}
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
}
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
</style>
</head>
<body>
<div id="loading-mask" class="loadmask">
<div class="loader-page">
<div class="romb" id="blue"></div>
<div class="romb" id="green"></div>
<div class="romb" id="red"></div>
</div>
</div>
<div id="viewport"></div>
<!-- debug begin -->
<script type="text/javascript">var less=less||{};less.env='development';</script>
<script src="../../../vendor/less/dist/less-1.5.1.js" type="text/javascript"></script>
<!-- debug end -->
<!-- application -->
<script type="text/javascript" src="../../../sdk/Common/docscoapisettings.js"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>
</body>
</html>

View File

@@ -1,97 +1,168 @@
<!DOCTYPE html>
<html>
<head>
<title>ONLYOFFICE Document Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="icon" href="resources/img/favicon.png" type="image/png" />
<link rel="stylesheet" type="text/css" href="../../../3rdparty/extjs/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="../../../sdk/Excel/css/main.css"/>
<link rel="stylesheet" type="text/css" href="../../../apps/spreadsheeteditor/main/resources/css/app-view.css">
<!-- splash -->
<style type="text/css">
.loadmask {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 20002;
}
.loadmask-body {
font-weight: bold;
font-family: Arial;
position:relative;
top:44%;
}
.loadmask-logo {
display:inline-block;
min-width: 220px;
height: 62px;
vertical-align:top;
background-image:url('./resources/img/loading-logo.gif');
background-repeat:no-repeat;
}
#loadmask-text {
color: #b2b2b2;
font-size: 10px;
height:14px;
margin-top:32px;
padding-left:44px;
text-align:left;
text-transform: uppercase;
}
#loadmask-tmlink {
border-top: 1px solid #d3d3d3;
margin-top: 15px;
padding-top: 11px;
width: 270px;
margin-left: -14px;
font-size: 18px;
color: #6e6e6e;
}
</style>
</head>
<body>
<div id="loading-mask" class="loadmask">
<div class="loadmask-body" align="center">
<div class="loadmask-logo">
<!-- <div id="loadmask-text">LOADING APPLICATION</div> -->
<!--<div id="loadmask-tmlink">www.onlyoffice.com</div>-->
</div>
</div>
</div>
<!-- 3rdparty -->
<script type="text/javascript" src="../../../3rdparty/extjs/ext-all.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/mousewheel/jquery.mousewheel.js"></script>
<script type="text/javascript" src="../../../3rdparty/jquery/jscrollpane/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../../../3rdparty/sockjs/sockjs-0.3.min.js"></script>
<script type="text/javascript" src="../../../3rdparty/underscore/underscore-min.js"></script>
<!-- application -->
<script type="text/javascript" src="../../../apps/spreadsheeteditor/main/app-view.js"></script>
<!-- sdk -->
<script type="text/javascript" src="../../../sdk/Common/AllFonts.js"></script>
<script type="text/javascript" src="../../../sdk/Excel/sdk-all.js"></script>
</body>
<!DOCTYPE html>
<html>
<head>
<title>ONLYOFFICE Document Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="icon" href="resources/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="../../../sdk/Excel/css/main.css"/>
<link rel="stylesheet" type="text/css" href="../../../apps/spreadsheeteditor/main/resources/css/app.css">
<!-- splash -->
<style type="text/css">
.loadmask {
left: 0;
top: 0;
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 100;
}
.loader-page {
top: 50%;
left: 50%;
width: 50px;
height: 180px;
z-index: 100;
position: absolute;
margin-top: -100px;
}
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
}
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0,2; }
100% { top:100px; background: #55bce6; }
}
</style>
</head>
<body>
<div id="loading-mask" class="loadmask">
<div class="loader-page">
<div class="romb" id="blue"></div>
<div class="romb" id="green"></div>
<div class="romb" id="red"></div>
</div>
</div>
<div id="viewport"></div>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More