[Libreoffice-commits] core.git: sc/source svx/sdi

2022-03-14 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh2.cxx |   11 +--
 svx/sdi/svx.sdi|2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit a342ac91e21dd45640b7dea063bc04b80f0feb6e
Author: Szymon Kłos 
AuthorDate: Wed Mar 9 21:32:35 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 14 14:16:14 2022 +0100

lok: insert textbox directly in Calc

Change-Id: I3ae00b255dfbaa34ab8d973356d12dfd0f71d345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131267
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131536
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 36b4a2cb9d6e..a1cf1879c12e 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -263,6 +263,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 case SID_DRAW_TEXT_MARQUEE:
 case SID_DRAW_NOTEEDIT:
 pTabView->SetDrawFuncPtr(new FuText(*this, pWin, pView, pDoc, 
aNewReq));
+bCreateDirectly = comphelper::LibreOfficeKit::isActive();
 break;
 
 case SID_FM_CREATE_CONTROL:
@@ -333,7 +334,6 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 }
 else
 {
-GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, 
SfxCallMode::ASYNCHRON);
 ScViewData& rViewData = GetViewData();
 tools::Long nLayoutSign = 
rViewData.GetDocument().IsLayoutRTL(rViewData.GetTabNo()) ? -1 : 1;
 aInsertPos = rViewData.getLOKVisibleArea().Center();
@@ -369,13 +369,20 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 // insert into page
 pView->InsertObjectAtView(pObj.release(), *pPageView);
 
-if ( nNewId == SID_DRAW_CAPTION || nNewId == SID_DRAW_CAPTION_VERTICAL )
+switch ( nNewId )
 {
+case SID_DRAW_CAPTION:
+case SID_DRAW_CAPTION_VERTICAL:
+case SID_DRAW_TEXT:
+case SID_DRAW_TEXT_VERTICAL:
 //  use KeyInput to start edit mode (FuText is created).
 //  For FuText objects, edit mode is handled within 
CreateDefaultObject.
 //  KEY_F2 is handled in FuDraw::KeyInput.
 
 pFuActual->KeyInput( KeyEvent( 0, vcl::KeyCode( KEY_F2 ) ) );
+break;
+default:
+break;
 }
 }
 
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index e57e3e5f5938..b4e3e50a2602 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -8574,7 +8574,7 @@ SfxBoolItem Text SID_ATTR_CHAR
 
 
 SfxBoolItem DrawText SID_DRAW_TEXT
-
+(SfxBoolItem CreateDirectly FN_PARAM_1)
 [
 AutoUpdate = TRUE,
 FastCall = FALSE,


[Libreoffice-commits] core.git: sc/source svx/sdi

2020-03-30 Thread Michael Meeks (via logerrit)
 sc/source/ui/view/formatsh.cxx |   59 ++---
 svx/sdi/svx.sdi|2 -
 2 files changed, 33 insertions(+), 28 deletions(-)

New commits:
commit c9f7f23c82e427fce14479f7806cec29b2abddf9
Author: Michael Meeks 
AuthorDate: Mon Mar 30 11:26:50 2020 +0100
Commit: Michael Meeks 
CommitDate: Mon Mar 30 15:41:42 2020 +0200

FrameLineColor - add Color parameter, and share code for color params.

Change-Id: I50483228221e817eb1a1d049d3c1ddf55a9c91d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91354
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index a83db735127c..b06463c71f68 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1640,6 +1640,27 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
 
 }
 
+namespace
+{
+bool lcl_getColorFromStr(const SfxItemSet *pArgs, Color &rColor)
+{
+const SfxPoolItem* pColorStringItem = nullptr;
+
+if (pArgs && SfxItemState::SET == 
pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem) && 
pColorStringItem)
+{
+OUString sColor;
+sColor = static_cast(pColorStringItem)->GetValue();
+
+if (sColor == "transparent")
+rColor = COL_TRANSPARENT;
+else
+rColor = Color(sColor.toInt32(16));
+return true;
+}
+return false;
+}
+}
+
 void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
 {
 ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
@@ -1783,16 +1804,9 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
 case SID_ATTR_CHAR_COLOR:
 case SID_SCATTR_PROTECTION :
 {
-const SfxPoolItem* pColorStringItem = nullptr;
-if ( SfxItemState::SET == pNewAttrs->GetItemState( 
SID_ATTR_COLOR_STR, false, &pColorStringItem ) )
+Color aColor;
+if (lcl_getColorFromStr(pNewAttrs, aColor))
 {
-Color aColor;
-OUString sColor = static_cast(pColorStringItem)->GetValue();
-if ( sColor == "transparent" )
-aColor = COL_TRANSPARENT;
-else
-aColor = Color( sColor.toInt32( 16 ) );
-
 SvxColorItem 
aColorItem(pTabViewShell->GetSelectionPattern()->
 GetItem( ATTR_FONT_COLOR ) );
 aColorItem.SetValue(aColor);
@@ -1868,18 +1882,20 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
 case SID_FRAME_LINECOLOR:
 {
 ::editeng::SvxBorderLine*  pDefLine = 
pTabViewShell->GetDefaultFrameLine();
-const Color&rColor = pNewAttrs->Get( 
SID_FRAME_LINECOLOR ).GetValue();
+
+Color aColor;
+if (!lcl_getColorFromStr(pNewAttrs, aColor))
+aColor = pNewAttrs->Get( SID_FRAME_LINECOLOR 
).GetValue();
 
 // Update default line
 if ( pDefLine )
 {
-pDefLine->SetColor( rColor );
+pDefLine->SetColor( aColor );
 pTabViewShell->SetSelectionFrameLines( pDefLine, true 
);
 }
 else
 {
-::editeng::SvxBorderLine aDefLine( &rColor, 20,
-SvxBorderLineStyle::SOLID );
+::editeng::SvxBorderLine aDefLine( &aColor, 20, 
SvxBorderLineStyle::SOLID );
 pTabViewShell->SetDefaultFrameLine( &aDefLine );
 pTabViewShell->SetSelectionFrameLines( &aDefLine, 
false );
 }
@@ -1991,27 +2007,16 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
 // ATTR_BACKGROUND (=SID_ATTR_BRUSH) has to be set to two IDs:
 case SID_BACKGROUND_COLOR:
 {
-const SfxPoolItem* pColorStringItem = nullptr;
 Color aColor;
 
-if ( SfxItemState::SET == pNewAttrs->GetItemState( 
SID_ATTR_COLOR_STR, false, &pColorStringItem ) )
-{
-OUString sColor = static_cast(pColorStringItem)->GetValue();
-if ( sColor == "transparent" )
-aColor = COL_TRANSPARENT;
-else
-aColor = Color( sColor.toInt32( 16 ) );
-}
-else
+if (!lcl_getColorFromStr(pNewAttrs, aColor))
 {
 const SvxColorItem&  rNewColorItem = pNewAttrs->Get( 
SID_BACKGROUND_COLOR );
 aColor = rNewColorItem