[Libreoffice-commits] core.git: 3 commits - basic/source sw/inc sw/sdi sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jun 19 02:42:08 PDT 2014
basic/source/sbx/sbxvalue.cxx | 4 +-
basic/source/sbx/sbxvar.cxx | 2 -
sw/inc/cmdid.h | 2 +
sw/inc/swcommands.h | 2 +
sw/sdi/drawsh.sdi | 14 +++++++++
sw/sdi/swriter.sdi | 48 ++++++++++++++++++++++++++++++++++
sw/source/ui/app/mn.src | 12 ++++++++
sw/source/uibase/shells/drawsh.cxx | 52 +++++++++++++++++++++++++++++++++++++
8 files changed, 133 insertions(+), 3 deletions(-)
New commits:
commit 692ea03e1d9974d036e1b9109c3fe32e1c0e51cd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jun 19 10:11:34 2014 +0200
sw: add UI for removing the textbox of a draw shape
Change-Id: Ib95573228d3dc98c88cd4af19995c99433c84ae6
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 79f4dc6..46c84b1 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -479,6 +479,7 @@
#define FN_EXPAND_GLOSSARY (FN_EXTRA + 28) /* expand text building blocks */
#define FN_CHANGE_PAGENUM (FN_EXTRA + 34) /* change page numbers*/
#define FN_ADD_TEXT_BOX (FN_EXTRA + 35) /* add text box to draw shape */
+#define FN_REMOVE_TEXT_BOX (FN_EXTRA + 36) /* remove text box of draw shape */
// Region: Glossary
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index 3417a74..0d7aadd 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -79,6 +79,7 @@
#define CMD_FN_PRINT_PAGEPREVIEW ".uno:PrintPagePreview"
#define CMD_FN_TABLE_SET_READ_ONLY_CELLS ".uno:Protect"
#define CMD_FN_REMOVE_CUR_TOX ".uno:RemoveTableOf"
+#define CMD_FN_REMOVE_TEXT_BOX ".uno:RemoveTextBox"
#define CMD_FN_FORMAT_RESET ".uno:ResetAttributes"
#define CMD_FN_TOOL_ANCHOR_AT_CHAR ".uno:SetAnchorAtChar"
#define CMD_FN_TOOL_ANCHOR_CHAR ".uno:SetAnchorToChar"
diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi
index d181a0d..5b2b27a 100644
--- a/sw/sdi/drawsh.sdi
+++ b/sw/sdi/drawsh.sdi
@@ -515,5 +515,12 @@ shell SwDrawShell : SwDrawBaseShell
StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
+
+ FN_REMOVE_TEXT_BOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
}
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 271ad17..fc78e4a 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -10103,3 +10103,27 @@ SfxVoidItem AddTextBox FN_ADD_TEXT_BOX
ToolBoxConfig = TRUE,
GroupId = GID_DRAWING;
]
+
+SfxVoidItem RemoveTextBox FN_REMOVE_TEXT_BOX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 80090e0..f62c8da 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -1050,6 +1050,12 @@ Menu MN_DRAW_POPUPMENU
HelpId = CMD_FN_ADD_TEXT_BOX;
Text [ en-US ] = "Add Text Box";
};
+ MenuItem
+ {
+ Identifier = FN_REMOVE_TEXT_BOX;
+ HelpId = CMD_FN_REMOVE_TEXT_BOX;
+ Text [ en-US ] = "Remove Text Box";
+ };
};
};
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 76d2538..d4887fa 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -409,6 +409,16 @@ void SwDrawShell::Execute(SfxRequest &rReq)
}
break;
}
+ case FN_REMOVE_TEXT_BOX:
+ {
+ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
+ {
+ SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
+ if (pFrmFmt)
+ SwTextBoxHelper::destroy(pFrmFmt);
+ }
+ break;
+ }
default:
OSL_ENSURE(!this, "wrong dispatcher");
return;
@@ -529,6 +539,21 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
rSet.DisableItem(nWhich);
break;
}
+ case FN_REMOVE_TEXT_BOX:
+ {
+ bool bDisable = true;
+ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
+ {
+ SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
+ // Allow removing a TextBox only in case it has one.
+ if (pFrmFmt && SwTextBoxHelper::findTextBox(pFrmFmt))
+ bDisable = false;
+ }
+
+ if (bDisable)
+ rSet.DisableItem(nWhich);
+ break;
+ }
}
nWhich = aIter.NextWhich();
}
commit 7f77b8a689f84a03495ac5911236b68f01ee7b24
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jun 19 10:11:10 2014 +0200
sw: add UI for adding a textbox for a draw shape
Change-Id: Icc4ff083431635f1769dba5907f26e7dc6b08d02
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index c27ceb9..79f4dc6 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -478,6 +478,7 @@
#define FN_EXPAND_GLOSSARY (FN_EXTRA + 28) /* expand text building blocks */
#define FN_CHANGE_PAGENUM (FN_EXTRA + 34) /* change page numbers*/
+#define FN_ADD_TEXT_BOX (FN_EXTRA + 35) /* add text box to draw shape */
// Region: Glossary
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index cc9bc07..3417a74 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -20,6 +20,7 @@
#define INCLUDED_SW_INC_SWCOMMANDS_H
#define CMD_SID_CREATE_SW_DRAWVIEW ".uno:CreateSWDrawView"
+#define CMD_FN_ADD_TEXT_BOX ".uno:AddTextBox"
#define CMD_FN_FRAME_ALIGN_VERT_BOTTOM ".uno:AlignBottom"
#define CMD_FN_FRAME_ALIGN_HORZ_CENTER ".uno:AlignHorizontalCenter"
#define CMD_FN_FRAME_ALIGN_HORZ_LEFT ".uno:AlignLeft"
diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi
index c45619d..d181a0d 100644
--- a/sw/sdi/drawsh.sdi
+++ b/sw/sdi/drawsh.sdi
@@ -508,5 +508,12 @@ shell SwDrawShell : SwDrawBaseShell
[
ExecMethod = Execute ;
]
+
+ FN_ADD_TEXT_BOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
}
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index eb66d88..271ad17 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -10079,3 +10079,27 @@ SvxLongLRSpaceItem SwPageLRMargin SID_ATTR_PAGE_LRSPACE
ToolBoxConfig = FALSE,
GroupId = GID_FORMAT;
]
+
+SfxVoidItem AddTextBox FN_ADD_TEXT_BOX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 4fa9b14..80090e0 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -1044,6 +1044,12 @@ Menu MN_DRAW_POPUPMENU
MN_FRM_CAPTION_ITEM
SEPARATOR ;
MN_DRAW3
+ MenuItem
+ {
+ Identifier = FN_ADD_TEXT_BOX;
+ HelpId = CMD_FN_ADD_TEXT_BOX;
+ Text [ en-US ] = "Add Text Box";
+ };
};
};
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index cf7dba7..76d2538 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -32,6 +32,8 @@
#include <svx/fontworkbar.hxx>
#include <svx/tbxcustomshapes.hxx>
#include <uitool.hxx>
+#include <dcontact.hxx>
+#include <textboxhelper.hxx>
#include <wview.hxx>
#include <swmodule.hxx>
#include <swwait.hxx>
@@ -397,6 +399,16 @@ void SwDrawShell::Execute(SfxRequest &rReq)
break;
}
+ case FN_ADD_TEXT_BOX:
+ {
+ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
+ {
+ SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
+ if (pFrmFmt)
+ SwTextBoxHelper::create(pFrmFmt);
+ }
+ break;
+ }
default:
OSL_ENSURE(!this, "wrong dispatcher");
return;
@@ -502,6 +514,21 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
break;
}
+ case FN_ADD_TEXT_BOX:
+ {
+ bool bDisable = true;
+ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
+ {
+ SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
+ // Allow creating a TextBox only in case this is a draw format without a TextBox so far.
+ if (pFrmFmt && pFrmFmt->Which() == RES_DRAWFRMFMT && !SwTextBoxHelper::findTextBox(pFrmFmt))
+ bDisable = false;
+ }
+
+ if (bDisable)
+ rSet.DisableItem(nWhich);
+ break;
+ }
}
nWhich = aIter.NextWhich();
}
commit f870059a5a777b1e198b2a34af0675eb36feb8be
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jun 19 10:10:15 2014 +0200
basic: silence expected SAL_WARN output
These were HACK() and DbgOut() messages previously, none of these ended
up on stderr. It seems that they are more or less harmless, so as long
as nobody fixes them, silence them, so more useful warnings are not
hidden when one does e.g. xray on a drawinglayer shape.
Change-Id: I7343d93d2916d9978852418aca725d027eb09128
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 0dd95d3..af454c7 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -190,7 +190,7 @@ void SbxValue::Clear()
{
if( aData.pObj != this )
{
- SAL_WARN("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
+ SAL_INFO("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
SbxVariable *pThisVar = PTR_CAST(SbxVariable, this);
bool bParentProp = pThisVar && 5345 ==
( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) );
@@ -536,7 +536,7 @@ bool SbxValue::Put( const SbxValues& rVal )
{
OSL_FAIL( "TheRealValue" );
}
- SAL_WARN("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
+ SAL_INFO("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
SbxVariable *pThisVar = PTR_CAST(SbxVariable, this);
bool bParentProp = pThisVar && 5345 ==
( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) );
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index f112e04..f9a9aca 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -413,7 +413,7 @@ void SbxVariable::SetParent( SbxObject* p )
bFound = ( this == pChildren->Get(nIdx) );
}
}
- SAL_WARN_IF(
+ SAL_INFO_IF(
!bFound, "basic.sbx",
"dangling: [" << GetName() << "].SetParent([" << p->GetName()
<< "])");
More information about the Libreoffice-commits
mailing list