Commit 52bece6a authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

DrawingObjects.js:

- getWorkbook()
- getDrawingObjects()

Worksheet.js
- add shapeCtx

Menu for shape selection


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47532 954022d7-b5bf-4e40-9824-e11837661b57
parent 09a2d19b
......@@ -1967,12 +1967,13 @@ function DrawingObjects() {
// Private
//-----------------------------------------------------------------------------------
var _this = this;
var _this = this;
var chartRender = new ChartRender();
var worksheet = null;
var isViewerMode = null;
var drawingCtx = null;
var overlayCtx = null;
var shapeCtx = null;
var aObjects = null;
var minImageWidth = 20;
var minImageHeight = 20;
......@@ -2001,6 +2002,7 @@ function DrawingObjects() {
drawingCtx = currentSheet.drawingCtx;
overlayCtx = currentSheet.overlayCtx;
shapeCtx = currentSheet.shapeCtx;
isViewerMode = function() { return worksheet._trigger("getViewerMode"); };
aObjects = [];
......@@ -2009,7 +2011,7 @@ function DrawingObjects() {
currentSheet.model.Drawings[i].worksheet = worksheet;
aObjects[i] = _this.cloneDrawingObject(currentSheet.model.Drawings[i]);
if (aObjects[i].isChart()) {
if (aObjects[i].isChart()) {
_this.calcChartInterval(aObjects[i].chart);
aObjects[i].chart.worksheet = worksheet;
}
......@@ -2030,6 +2032,14 @@ function DrawingObjects() {
}
}
_this.getWorkbook = function() {
return (worksheet ? worksheet.model.workbook : null);
}
_this.getDrawingObjects = function() {
return aObjects;
}
_this.setShiftKey = function(bShiftKey) {
shiftKey = bShiftKey;
}
......@@ -2437,7 +2447,8 @@ function DrawingObjects() {
_t.size = { width: 0, height: 0, coeff: 1 };
_t.move = { x: 0, y: 0, inAction: false };
_t.chart = new asc_CChart();
_t.chart = new asc_CChart();
_t.shape = null; //new CShape(_t);
_t.flags = {
selected: false,
......@@ -2455,6 +2466,10 @@ function DrawingObjects() {
_t.isChart = function() {
return _t.chart.type ? true : false;
}
_t.isShape = function() {
return _t.shape != null;
}
// Проверяет выход за границы
......@@ -4736,6 +4751,12 @@ function DrawingObjects() {
fileName.click();
}
//-----------------------------------------------------------------------------------
// Shapes controller
//-----------------------------------------------------------------------------------
_this.controller = new DrawingObjectsController(_this);
//-----------------------------------------------------------------------------------
// Private Misc Methods
//-----------------------------------------------------------------------------------
......
......@@ -130,7 +130,18 @@
<!--for colors-->
<script src="../Common/Charts/libraries/hsv.js"></script>
<script src="../Common/Charts/libraries/rgbcolor.js"></script>
<!--for shapes-->
<script src="../Word/Drawing/Graphics.js"></script>
<script src="model/DrawingObjects/DrawingObjectsController.js"></script>
<script src="model/DrawingObjects/States.js"></script>
<script src="model/DrawingObjects/Format/GroupShape.js"></script>
<script src="model/DrawingObjects/Format/Image.js"></script>
<script src="model/DrawingObjects/Format/Shape.js"></script>
<script src="model/DrawingObjects/Tracks/ResizeTracks.js"></script>
<script src="model/DrawingObjects/Tracks/RotateTracks.js"></script>
<style type="text/css">
......@@ -1606,6 +1617,13 @@
<img class="ToolbarIcon FixedAreaClean" src="menu/img/spacer.gif"/>
</div>
</li>
</ul>
<ul class="noListStyle">
<li class="ToolbarIconOut selectableIcon" title="Add shape">
<div id="td_shape" class="ToolbarIconOut selectableIcon iconToolbar">
<img class="ToolbarIcon ToolbarIconMenuAsc ToolbarAddShape" src="menu/img/spacer.gif"/>
</div>
</li>
</ul>
</td>
<td class="cp toolbarSep" style="vertical-align: top; width: 15px;min-width:15px;">
......@@ -2128,5 +2146,250 @@
</fieldset>
</div>
</div>
<div id="shapeBox" class="options hidden">
<table>
<tr>
<td class="cell" title="line"><img src="menu/img/line.bmp"></td>
<td class="cell" title="textRect"><img src="menu/img/Irregular2.bmp"></td>
<td class="cell" title="spline"><img src="menu/img/ellipse.bmp"></td>
<td class="cell" title="curvedConnector2"><img src="menu/img/star5.bmp"></td>
<td class="cell" title="mathDivide"><img src="menu/img/star6.bmp"></td>
<td class="cell" title="leftRightArrow"><img src="menu/img/star7.bmp"></td>
<td class="cell" title="star8"><img src="menu/img/star8.bmp"></td>
<td class="cell" title="star10"><img src="menu/img/star10.bmp"></td>
<td class="cell" title="star12"><img src="menu/img/star12.bmp"></td>
<td class="cell" title="star16"><img src="menu/img/star16.bmp"></td>
<td class="cell" title="polyline1"><img src="menu/img/star24.bmp"></td>
<td class="cell" title="polyline2"><img src="menu/img/star32.bmp"></td>
</tr>
<tr>
<td class="cell" title="ribbon"><img src="menu/img/ribbon.bmp">
<td class="cell" title="ribbon2"><img src="menu/img/ribbon2.bmp">
<td class="cell" title="ellipseRibbon"><img src="menu/img/ellipseRibbon.bmp">
<td class="cell" title="ellipseRibbon2"><img src="menu/img/ellipseRibbon2.bmp">
<td class="cell" title="verticalScroll"><img src="menu/img/verticalScroll.bmp">
<td class="cell" title="horizontalScroll"><img src="menu/img/horizontalScroll.bmp">
<td class="cell" title="wave"><img src="menu/img/wave.bmp">
<td class="cell" title="doubleWave"><img src="menu/img/dowbleWave.bmp">
<td class="cell" title="triangle"><img src="menu/img/triangle.bmp">
<td class="cell" title="rtTriangle"><img src="menu/img/rtTriangle.bmp">
<td class="cell" title="smileyFace"><img src="menu/img/smileyFace.bmp">
<td class="cell" title="heart"><img src="menu/img/heart.bmp"></td>
</tr>
<tr>
<td class="cell" title="wedgeRectCallout"><img src="menu/img/wedgeRectCallout.bmp"></td>
<td class="cell" title="wedgeRoundRectCallout"><img src="menu/img/wedgeRoundRectCallout.bmp"></td>
<td class="cell" title="wedgeEllipseCallout"><img src="menu/img/wedgeEllipseCallout.bmp"></td>
<td class="cell" title="cloudCallout"><img src="menu/img/cloudCallout.bmp"></td>
<td class="cell" title="borderCallout1"><img src="menu/img/borderCallout1.bmp"></td>
<td class="cell" title="borderCallout2"><img src="menu/img/borderCallout2.bmp"></td>
<td class="cell" title="borderCallout3"><img src="menu/img/borderCallout3.bmp"></td>
<td class="cell" title="accentCallout1"><img src="menu/img/accentCallout1.bmp"></td>
<td class="cell" title="accentCallout2"><img src="menu/img/accentCallout2.bmp"></td>
<td class="cell" title="accentCallout3"><img src="menu/img/accentCallout3.bmp"></td>
<td class="cell" title="callout1"><img src="menu/img/callout1.bmp"></td>
<td class="cell" title="callout2"><img src="menu/img/callout2.bmp"></td>
</tr>
<tr>
<td class="cell" title="callout3"><img src="menu/img/callout3.bmp"></td>
<td class="cell" title="accentBorderCallout1"><img src="menu/img/accentBorderCallout1.bmp"></td>
<td class="cell" title="accentBorderCallout2"><img src="menu/img/accentBorderCallout2.bmp"></td>
<td class="cell" title="accentBorderCallout3"><img src="menu/img/accentBorderCallout3.bmp"></td>
<td class="cell" title="lightningBolt"><img src="menu/img/lightningBolt.bmp"></td>
<td class="cell" title="sun"><img src="menu/img/sun.bmp"></td>
<td class="cell" title="moon"><img src="menu/img/moon.bmp"></td>
<td class="cell" title="cloud"><img src="menu/img/cloud.bmp"></td>
<td class="cell" title="nonIsoscelesTrapezoid"><img src="menu/img/nonIsoscelesTrapezoid.bmp"></td>
<td class="cell" title="noSmoking"><img src="menu/img/noSmoking.bmp"></td>
<td class="cell" title="notchedRightArrow"><img src="menu/img/notchedRightArrow.bmp"></td>
<td class="cell" title="octagon"><img src="menu/img/octagon.bmp"></td>
</tr>
<tr>
<td class="cell" title="lineWithArrow"><img src="menu/img/parallelogram.bmp"></td>
<td class="cell" title="lineWithTwoArrow"><img src="menu/img/pentagon.bmp"></td>
<td class="cell" title="pie"><img src="menu/img/pie.bmp"></td>
<td class="cell" title="plaque"><img src="menu/img/plaque.bmp"></td>
<td class="cell" title="quadArrow"><img src="menu/img/quadArrow.bmp"></td>
<td class="cell" title="quadArrowCallout"><img src="menu/img/quadArrowCallout.bmp"></td>
<td class="cell" title="curvedDownArrow"><img src="menu/img/curvedDownArrow.bmp"></td>
<td class="cell" title="curvedLeftArrow"><img src="menu/img/curvedLeftArrow.bmp"></td>
<td class="cell" title="curvedRightArrow"><img src="menu/img/curvedRightArrow.bmp"></td>
<td class="cell" title="curvedUpArrow"><img src="menu/img/curvedUpArrow.bmp"></td>
<td class="cell" title="polyline1"><img src="menu/img/octagon.bmp"></td>
<td class="cell" title="polyline2"><img src="menu/img/octagon.bmp"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</body>
</html>
......@@ -107,6 +107,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.isChartEditor = false;
this.chartStyleManager = new ChartStyleManager();
this.chartPreviewManager = new ChartPreviewManager();
// Shapes
this.isStartAddShape = false;
this.addShapePreset = "";
/**************************************/
this.OpenDocumentProgress = {
......@@ -2037,7 +2041,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return ws.cellCommentator.asc_hideComments();
},
asc_getWorkbookComments: function() {
asc_getWorkbookComments: function() {
var _this = this, comments = [];
if ( _this.wb ) {
for (var i = 0; i < _this.wb.model.aWorksheets.length; i++) {
......@@ -2049,8 +2053,24 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return comments;
},
// Shapes
asc_startAddShape: function(sPreset, is_apply) {
this.isStartAddShape = true;
this.addShapePreset = sPreset;
if (is_apply)
{
//this.WordControl.m_oDrawingDocument.LockCursorType("crosshair");
}
else
{
//editor.sync_EndAddShape();
//editor.sync_StartAddShapeCallback(false);
}
},
// Cell interface
asc_getCellInfo: function (bExt) {
return this.wb.getWorksheet().getSelectionInfo(!!bExt);
},
......@@ -2794,10 +2814,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_getComments"] = prot.asc_getComments;
prot["asc_getDocumentComments"] = prot.asc_getDocumentComments;
prot["asc_getWorkbookComments"] = prot.asc_getWorkbookComments;
prot["asc_getWorkbookComments"] = prot.asc_getWorkbookComments;
// Shapes
prot["asc_startAddShape"] = prot.asc_startAddShape;
// Cell interface
prot["asc_getCellInfo"] = prot.asc_getCellInfo;
prot["asc_getActiveCellCoord"] = prot.asc_getActiveCellCoord;
prot["asc_setCellFontName"] = prot.asc_setCellFontName;
......
......@@ -2510,4 +2510,61 @@
$("#selectAllElements").addClass('SelectedAutoFilterItem')
});
// Shapes
$("#td_shape").mousedown(function(event) {
if ( "none" != ($("#shapeBox").css("display")) ) {
IsVisibleMenu = true;
}
});
$("#td_shape").click(
function()
{
if ( !IsVisibleMenu )
{
var offset = $("#td_shape").offset();
offset.top += $("#td_shape").outerHeight() - 1;
$("#shapeBox").css("top", offset.top);
$("#shapeBox").css("left", offset.left);
$("#shapeBox").attr("init", "shapePrst").show();
}
else
{
$("#shapeBox").attr("init", "shapePrst").hide();
}
IsVisibleMenu = false;
}
);
$(".cell").css("width", "20px");
$(".cell").css("height", "20px");
$(".cell").css("padding", "2px");
$(".cell").mousedown(
function()
{
$(this).css("border", "3px solid #000");
$("#shapeBox").attr("init", "shapePrst").hide();
api.asc_startAddShape($(this).attr("title"), true);
}
);
$(".cell").mouseover(
function()
{
$(this).css("border", "1px solid #000");
}
);
$(".cell").mouseup(
function()
{
$(this).css("border", "1px solid #000");
}
);
$(".cell").mouseout(
function()
{
$(this).css("border", "0px solid #000");
}
);
});
\ No newline at end of file
......@@ -984,4 +984,8 @@ input, textarea {outline:none;}
.menuChartFont {
cursor: pointer;
}
.ToolbarAddShape{
background: url("../img/drawing-16.png") no-repeat scroll 0 0 transparent;
}
\ No newline at end of file
......@@ -370,6 +370,8 @@
this.buffers = buffers;
this.drawingCtx = this.buffers.main;
this.overlayCtx = this.buffers.overlay;
this.shapeCtx = new CGraphics();
this.shapeCtx.init(this.drawingCtx.ctx, this.drawingCtx.getWidth(0), this.drawingCtx.getHeight(0), this.drawingCtx.getWidth(3), this.drawingCtx.getHeight(3));
this.stringRender = stringRender;
......@@ -629,6 +631,7 @@
this._prepareCellTextMetricsCache(this.visibleRange);
this._shiftVisibleRange();
this.cellCommentator.updateCommentPosition();
this.shapeCtx.init(this.drawingCtx.ctx, this.drawingCtx.getWidth(0), this.drawingCtx.getHeight(0), this.drawingCtx.getWidth(3), this.drawingCtx.getHeight(3));
this.updateZoom = false;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment