You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2013/06/25 05:29:19 UTC
[Bug 122582] New: Module cui - Add new color
https://issues.apache.org/ooo/show_bug.cgi?id=122582
Bug ID: 122582
Issue Type: DEFECT
Summary: Module cui - Add new color
Product: App Dev
Version: AOO400-dev
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: api
Assignee: issues@openoffice.apache.org
Reporter: ivan.pootdiaz@gmail.com
CC: issues@openoffice.apache.org
Created attachment 80906
--> https://issues.apache.org/ooo/attachment.cgi?id=80906&action=edit
new color
Hi all,
This patch "registrodom.patch":
This code snippet allows Auto Registration the colors to Apache OpenOffice
Drawing , ie the self-colored. Through this patch allows the user to add new
colors in the color palette without entering a name.
If the color name already exists, it is automatically assigned a number to the
name, eg
open
open4509
open0267
open8160
open1094 ...
This code I've been working in the module cui (file: tpcolor.cxx). I would like
that the community to help implement this code in AOO.
The Auto Registration of colors: I think an excellent idea as draw integrated
this functionality in AOO and allow the user to add new colors without many's
restrictions, this process could be done more quickly and efficiently. No doubt
it would be very useful in my humble opinion.
Best Regards.
registrodom.patch:
--- tpcparche.cxx 2013-04-08 19:41:41.000000000 -0500
+++ tpcolor.cxx 2013-05-07 14:03:05.890419322 -0500
@@ -24,6 +24,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <cstdlib>
+using std::rand;
+using rtl::OUStringBuffer;
+
// include ---------------------------------------------------------------
#include <tools/shl.hxx>
#include <tools/urlobj.hxx>
@@ -480,10 +485,10 @@
sal_Bool bDifferent = sal_True;
// Pruefen, ob Name schon vorhanden ist
- for ( long i = 0; i < nCount && bDifferent; i++ )
+ /*for ( long i = 0; i < nCount && bDifferent; i++ )
if ( aName == pColorTab->GetColor( i )->GetName() )
- bDifferent = sal_False;
-
+ bDifferent = sal_False;*/
+
// Wenn ja, wird wiederholt ein neuer Name angefordert
if ( !bDifferent )
{
@@ -516,16 +521,115 @@
}
delete( pDlg );
}
-
+
// Wenn nicht vorhanden, wird Eintrag aufgenommen
if( bDifferent )
{
+ // string concatination
+
+ // give it an initial size
+ OUStringBuffer buf( 128 );
+
+ //append aName to String
+ buf.append( aName );
+
+ //checks if the name already exists
+ for ( long i = 0; i < nCount && bDifferent; i++ )
+ if ( aName == pColorTab->GetColor( i )->GetName() )
+ bDifferent = sal_False;
+
+ if ( !bDifferent )
+ {
+ sal_Int32 nLen = buf.getLength();
+ String ab = buf.charAt(nLen - 1);
+
+ sal_Int32 xx = std::rand() % 5000 + 1000;
+
+ if (ab == '1' || ab == '2' || ab == '3' || ab == '4' || ab == '5' ||
ab == '6' || ab == '7' || ab == '8' || ab == '9' || ab == '0')
+ {
+ buf.setLength(nLen - 4);
+ buf.append( xx );
+ }else{
+ buf.append( xx );
+ }
+
+ }
+
+ // now transfer the buffer into the string.
+ String lstring = buf.makeStringAndClear();
+
if (eCM != CM_RGB)
ConvertColorValues (aAktuellColor, CM_RGB);
- pEntry = new XColorEntry( aAktuellColor, aName );
+ pEntry = new XColorEntry( aAktuellColor, lstring );
pColorTab->Insert( pColorTab->Count(), pEntry );
-
+
aLbColor.Append( pEntry );
aValSetColorTable.InsertItem( aValSetColorTable.GetItemCount() + 1,
pEntry->GetColor(), pEntry->GetName() );
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
[Bug 122582] Module cui - Add new color
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=122582
Armin Le Grand <Ar...@me.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Armin.Le.Grand@me.com
Assignee|issues@openoffice.apache.or |Armin.Le.Grand@me.com
|g |
--- Comment #1 from Armin Le Grand <Ar...@me.com> ---
ALG: Thanks, will have a look ASAP, grepping..
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
[Bug 122582] Module cui - Add new color
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=122582
Andrea Pescetti <pe...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pescetti@apache.org
Issue Type|DEFECT |PATCH
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.