Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
3a8c1b36
Commit
3a8c1b36
authored
Aug 02, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug #32699. Fixed bug with adjusting image size to column width.
parent
e4bcecae
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
4 deletions
+95
-4
word/Editor/Document.js
word/Editor/Document.js
+35
-0
word/Editor/DocumentControllerBase.js
word/Editor/DocumentControllerBase.js
+5
-0
word/Editor/DrawingsController.js
word/Editor/DrawingsController.js
+11
-0
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+11
-0
word/Editor/HeaderFooterController.js
word/Editor/HeaderFooterController.js
+21
-0
word/Editor/LogicDocumentController.js
word/Editor/LogicDocumentController.js
+4
-0
word/api.js
word/api.js
+8
-4
No files found.
word/Editor/Document.js
View file @
3a8c1b36
...
...
@@ -10968,6 +10968,13 @@ CDocument.prototype.DecreaseIndent = function()
this
.
Recalculate
();
}
};
/**
* Получаем размеры текущей колонки (используется при вставке изображения).
*/
CDocument
.
prototype
.
GetColumnSize
=
function
()
{
return
this
.
Controller
.
GetColumnSize
();
};
//----------------------------------------------------------------------------------------------------------------------
// Settings
//----------------------------------------------------------------------------------------------------------------------
...
...
@@ -15920,6 +15927,34 @@ CDocument.prototype.controller_RestoreDocumentStateAfterLoadChanges = function(S
this
.
NeedUpdateTarget
=
true
;
}
};
CDocument
.
prototype
.
controller_GetColumnSize
=
function
()
{
var
ContentPos
=
true
===
this
.
Selection
.
Use
?
(
this
.
Selection
.
StartPos
<
this
.
Selection
.
EndPos
?
this
.
Selection
.
StartPos
:
this
.
Selection
.
EndPos
)
:
this
.
CurPos
.
ContentPos
;
var
PagePos
=
this
.
Get_DocumentPagePositionByContentPosition
(
this
.
Get_ContentPosition
(
this
.
Selection
.
Use
,
false
));
var
ColumnAbs
=
PagePos
?
PagePos
.
Column
:
0
;
var
SectPr
=
this
.
Get_SectPr
(
ContentPos
);
var
Y
=
SectPr
.
Get_PageMargin_Top
();
var
YLimit
=
SectPr
.
Get_PageHeight
()
-
SectPr
.
Get_PageMargin_Bottom
();
var
X
=
SectPr
.
Get_PageMargin_Left
();
var
XLimit
=
SectPr
.
Get_PageWidth
()
-
SectPr
.
Get_PageMargin_Right
();
var
ColumnsCount
=
SectPr
.
Get_ColumnsCount
();
for
(
var
ColumnIndex
=
0
;
ColumnIndex
<
ColumnAbs
;
++
ColumnIndex
)
{
X
+=
SectPr
.
Get_ColumnWidth
(
ColumnIndex
);
X
+=
SectPr
.
Get_ColumnSpace
(
ColumnIndex
);
}
if
(
ColumnsCount
-
1
!==
ColumnAbs
)
XLimit
=
X
+
SectPr
.
Get_ColumnWidth
(
ColumnAbs
);
return
{
W
:
XLimit
-
X
,
H
:
YLimit
-
Y
};
};
//----------------------------------------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/DocumentControllerBase.js
View file @
3a8c1b36
...
...
@@ -717,3 +717,8 @@ CDocumentControllerBase.prototype.SaveDocumentStateBeforeLoadChanges = function(
* @param State
*/
CDocumentControllerBase
.
prototype
.
RestoreDocumentStateAfterLoadChanges
=
function
(
State
){};
/**
* Получаем размеры текущей колонки.
* @returns {{W: number, H: number}}
*/
CDocumentControllerBase
.
prototype
.
GetColumnSize
=
function
(){
return
{
W
:
0
,
H
:
0
};};
word/Editor/DrawingsController.js
View file @
3a8c1b36
...
...
@@ -497,5 +497,16 @@ CDrawingsController.prototype.RestoreDocumentStateAfterLoadChanges = function(St
LogicDocument
.
Content
[
ContentPos
].
Cursor_MoveToStartPos
(
false
);
}
};
CDrawingsController
.
prototype
.
GetColumnSize
=
function
()
{
// TODO: Переделать
var
_w
=
Math
.
max
(
1
,
AscCommon
.
Page_Width
-
(
AscCommon
.
X_Left_Margin
+
AscCommon
.
X_Right_Margin
));
var
_h
=
Math
.
max
(
1
,
AscCommon
.
Page_Height
-
(
AscCommon
.
Y_Top_Margin
+
AscCommon
.
Y_Bottom_Margin
));
return
{
W
:
AscCommon
.
Page_Width
-
(
AscCommon
.
X_Left_Margin
+
AscCommon
.
X_Right_Margin
),
H
:
AscCommon
.
Page_Height
-
(
AscCommon
.
Y_Top_Margin
+
AscCommon
.
Y_Bottom_Margin
)
};
};
word/Editor/Footnotes.js
View file @
3a8c1b36
...
...
@@ -2614,6 +2614,17 @@ CFootnotesController.prototype.RestoreDocumentStateAfterLoadChanges = function(S
}
}
};
CFootnotesController
.
prototype
.
GetColumnSize
=
function
()
{
// TODO: Переделать
var
_w
=
Math
.
max
(
1
,
AscCommon
.
Page_Width
-
(
AscCommon
.
X_Left_Margin
+
AscCommon
.
X_Right_Margin
));
var
_h
=
Math
.
max
(
1
,
AscCommon
.
Page_Height
-
(
AscCommon
.
Y_Top_Margin
+
AscCommon
.
Y_Bottom_Margin
));
return
{
W
:
AscCommon
.
Page_Width
-
(
AscCommon
.
X_Left_Margin
+
AscCommon
.
X_Right_Margin
),
H
:
AscCommon
.
Page_Height
-
(
AscCommon
.
Y_Top_Margin
+
AscCommon
.
Y_Bottom_Margin
)
};
};
function
CFootEndnotePage
()
...
...
word/Editor/HeaderFooterController.js
View file @
3a8c1b36
...
...
@@ -449,4 +449,25 @@ CHdrFtrController.prototype.RestoreDocumentStateAfterLoadChanges = function(Stat
{
this
.
LogicDocument
.
Document_End_HdrFtrEditing
();
}
};
CHdrFtrController
.
prototype
.
GetColumnSize
=
function
()
{
var
CurHdrFtr
=
this
.
HdrFtr
.
CurHdrFtr
;
if
(
null
!==
CurHdrFtr
&&
-
1
!==
CurHdrFtr
.
RecalcInfo
.
CurPage
)
{
var
Page
=
this
.
LogicDocument
.
Pages
[
CurHdrFtr
.
RecalcInfo
.
CurPage
];
var
SectPr
=
this
.
LogicDocument
.
Get_SectPr
(
Page
.
Pos
);
var
Y
=
SectPr
.
Get_PageMargin_Top
();
var
YLimit
=
SectPr
.
Get_PageHeight
()
-
SectPr
.
Get_PageMargin_Bottom
();
var
X
=
SectPr
.
Get_PageMargin_Left
();
var
XLimit
=
SectPr
.
Get_PageWidth
()
-
SectPr
.
Get_PageMargin_Right
();
return
{
W
:
XLimit
-
X
,
H
:
YLimit
-
Y
};
}
return
{
W
:
0
,
H
:
0
};
};
\ No newline at end of file
word/Editor/LogicDocumentController.js
View file @
3a8c1b36
...
...
@@ -365,3 +365,7 @@ CLogicDocumentController.prototype.RestoreDocumentStateAfterLoadChanges = functi
{
this
.
LogicDocument
.
controller_RestoreDocumentStateAfterLoadChanges
(
State
);
};
CLogicDocumentController
.
prototype
.
GetColumnSize
=
function
()
{
return
this
.
LogicDocument
.
controller_GetColumnSize
();
};
word/api.js
View file @
3a8c1b36
...
...
@@ -5017,8 +5017,10 @@ background-repeat: no-repeat;\
var
_image
=
this
.
ImageLoader
.
LoadImage
(
url
,
1
);
if
(
null
!=
_image
)
{
var
_w
=
Math
.
max
(
1
,
AscCommon
.
Page_Width
-
(
AscCommon
.
X_Left_Margin
+
AscCommon
.
X_Right_Margin
));
var
_h
=
Math
.
max
(
1
,
AscCommon
.
Page_Height
-
(
AscCommon
.
Y_Top_Margin
+
AscCommon
.
Y_Bottom_Margin
));
var
ColumnSize
=
this
.
WordControl
.
m_oLogicDocument
.
GetColumnSize
();
var
_w
=
Math
.
max
(
1
,
ColumnSize
.
W
);
var
_h
=
Math
.
max
(
1
,
ColumnSize
.
H
);
if
(
_image
.
Image
!=
null
)
{
var
__w
=
Math
.
max
(
parseInt
(
_image
.
Image
.
width
*
AscCommon
.
g_dKoef_pix_to_mm
),
1
);
...
...
@@ -5068,8 +5070,10 @@ background-repeat: no-repeat;\
this
.
sync_StartAction
(
c_oAscAsyncActionType
.
BlockInteraction
,
c_oAscAsyncAction
.
LoadImage
);
this
.
asyncImageEndLoaded2
=
function
(
_image
)
{
var
_w
=
Math
.
max
(
1
,
AscCommon
.
Page_Width
-
(
AscCommon
.
X_Left_Margin
+
AscCommon
.
X_Right_Margin
));
var
_h
=
Math
.
max
(
1
,
AscCommon
.
Page_Height
-
(
AscCommon
.
Y_Top_Margin
+
AscCommon
.
Y_Bottom_Margin
));
var
ColumnSize
=
this
.
WordControl
.
m_oLogicDocument
.
GetColumnSize
();
var
_w
=
Math
.
max
(
1
,
ColumnSize
.
W
);
var
_h
=
Math
.
max
(
1
,
ColumnSize
.
H
);
if
(
_image
.
Image
!=
null
)
{
var
__w
=
Math
.
max
(
parseInt
(
_image
.
Image
.
width
*
AscCommon
.
g_dKoef_pix_to_mm
),
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment